How to get virtualenv to use dist-packages on Ubuntu?

后端 未结 5 1912
一向
一向 2020-12-13 20:06

I know that virtualenv, if not passed the --no-site-packages argument when creating a new virtual environment, will link the packages in /usr/local/lib/py

5条回答
  •  温柔的废话
    2020-12-13 20:54

    This might be a legitimate use of PYTHONPATH - an environmental variable that virtualenv doesn't touch, which uses the same syntax as the environmental variable PATH, in bash PYTHONPATH=/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages in a .bashrc or similar. If you followed this path,

    1. You don't have to tell your virtual environment about this at all, it won't try to change it.

    2. No relinking will be required, and

    3. That will still go wherever it would have gone (pip install always uses /usr/local/lib/python2.7/dist-packages/ for my Ubuntu) if you install them outside of your virtual environment. If you install them from within your virtual environment (while it's activated) then of course it'll be put in the virtualenvironment.

提交回复
热议问题