How do I add a path to PYTHONPATH in virtualenv

后端 未结 5 1204
渐次进展
渐次进展 2020-11-27 09:29

I am trying to add a path to the PYTHONPATH environment variable, that would be only visible from a particular virtualenv environment.

I tried SET PYTHONPATH=

5条回答
  •  一生所求
    2020-11-27 10:12

    You can also try to put symlink to one of your virtualenv.

    eg. 1) activate your virtualenv 2) run python 3) import sys and check sys.path 4) you will find python search path there. Choose one of those (eg. site-packages) 5) go there and create symlink to your package like: ln -s path-to-your-package name-with-which-you'll-be-importing

    That way you should be able to import it even without activating your virtualenv. Simply try: path-to-your-virtualenv-folder/bin/python and import your package.

提交回复
热议问题