Install local dist package into virtualenv

mirandak

I have a pytest test, let's call it test.py. I used to run this test outside of virtualenv; now I'm trying to run it inside a virtualenv sandbox.

The project is structured like this:

~/project/test # where test.py and all virtualenv files live
~/project/mylibrary

test.py imports from mylibrary. In the past, this worked because I have the code in ~/project/mylibrary installed into /usr/lib/python2.7/dist-packages/mylibrary.

I can't run virtualenv with the --system-site-packages flag. I also can't move the code from ~/project/mylibrary into the ~/project/test folder. How can I get access to the code in mylibrary inside my virtualenv?

ali_m

You don't need to do anything special - as long as you are working inside a virtualenv, python setup.py install will automatically install packages into

$VIRTUAL_ENV/lib/python2.7/site-packages

rather than your system-wide

/usr/lib/python2.7/dist-packages

directory.

In general it's better to use pip install mylibrary/, since this way you can neatly uninstall the package using pip uninstall mylibrary.

If you're installing a working copy of some code that you're developing, it might be a good idea to install it in "editable" mode using pip install -e mylibrary/, which creates a link to your source directory so that your installed module gets updated as you edit the code.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何让virtualenv在Ubuntu上使用dist-packages?

来自分类Dev

将本地dist软件包安装到virtualenv

来自分类Dev

can't install virtualenv on ubuntu 12.04

来自分类Dev

virtualenv与setup.py install --user

来自分类Dev

virtualenv versus setup.py install --user

来自分类Dev

Autoloading local composer package

来自分类Dev

ACTION_INSTALL_PACKAGE

来自分类Dev

为什么python在virtualenv中看不到dist-packages?

来自分类Dev

ghc-pkg:无法创建:dist / dist-sandbox-XXXXXXXX / package.conf.inplace已存在

来自分类Dev

权限被拒绝:'/usr/local/lib/python2.7/dist-packages/pytz-2017.2.dist-info'

来自分类Dev

npm install不会创建dist文件夹

来自分类Dev

如何回滚“ apt-get install dist-upgrade”?

来自分类Dev

如何回滚“ apt-get install dist-upgrade”?

来自分类Dev

Create virtualenv in existing directory without creating a "local" directory

来自分类Dev

virtualenv中的Python easy_install提供setuptools错误

来自分类Dev

pip install PIL不会安装到virtualenv中

来自分类Dev

通过 pip install virtualenv 安装时出现 UnicodeDecodeError

来自分类Dev

Unable to install cachem package for R

来自分类Dev

Is there any way to install a transient package?

来自分类Dev

OSError:[Errno 13]权限被拒绝:'/usr/local/lib/python2.7/dist-packages/pelican-3.6.3.dist-info'

来自分类Dev

“ npm install [package]”不会更新package.json

来自分类Dev

Install only one package from package.json?

来自分类Dev

npm脚本,捆绑时将package.json复制到dist

来自分类Dev

错误:无法创建'/usr/local/lib/python2.7/dist-packages/sklearn':权限被拒绝

来自分类Dev

package.json与“ npm install%s -g”

来自分类Dev

Unable to install XML package in R on CentOS

来自分类Dev

npm install无法读取package.json

来自分类Dev

package.json与“ npm install%s -g”

来自分类Dev

调用`composer install`应该只使用satis dist zip文件,不要使用source

Related 相关文章

  1. 1

    如何让virtualenv在Ubuntu上使用dist-packages?

  2. 2

    将本地dist软件包安装到virtualenv

  3. 3

    can't install virtualenv on ubuntu 12.04

  4. 4

    virtualenv与setup.py install --user

  5. 5

    virtualenv versus setup.py install --user

  6. 6

    Autoloading local composer package

  7. 7

    ACTION_INSTALL_PACKAGE

  8. 8

    为什么python在virtualenv中看不到dist-packages?

  9. 9

    ghc-pkg:无法创建:dist / dist-sandbox-XXXXXXXX / package.conf.inplace已存在

  10. 10

    权限被拒绝:'/usr/local/lib/python2.7/dist-packages/pytz-2017.2.dist-info'

  11. 11

    npm install不会创建dist文件夹

  12. 12

    如何回滚“ apt-get install dist-upgrade”?

  13. 13

    如何回滚“ apt-get install dist-upgrade”?

  14. 14

    Create virtualenv in existing directory without creating a "local" directory

  15. 15

    virtualenv中的Python easy_install提供setuptools错误

  16. 16

    pip install PIL不会安装到virtualenv中

  17. 17

    通过 pip install virtualenv 安装时出现 UnicodeDecodeError

  18. 18

    Unable to install cachem package for R

  19. 19

    Is there any way to install a transient package?

  20. 20

    OSError:[Errno 13]权限被拒绝:'/usr/local/lib/python2.7/dist-packages/pelican-3.6.3.dist-info'

  21. 21

    “ npm install [package]”不会更新package.json

  22. 22

    Install only one package from package.json?

  23. 23

    npm脚本,捆绑时将package.json复制到dist

  24. 24

    错误:无法创建'/usr/local/lib/python2.7/dist-packages/sklearn':权限被拒绝

  25. 25

    package.json与“ npm install%s -g”

  26. 26

    Unable to install XML package in R on CentOS

  27. 27

    npm install无法读取package.json

  28. 28

    package.json与“ npm install%s -g”

  29. 29

    调用`composer install`应该只使用satis dist zip文件,不要使用source

热门标签

归档