0
我快VIRTUALENV這樣的:Virtualenv包含全球套餐/我如何清除我的PYTHONPATH?
$ virtualenv --no-site-packages venv
New python executable in .../venv/bin/python
Installing setuptools, pip, wheel...done.
$ source venv/bin/activate
但是,當我pip freeze -l
,我沒有得到任何東西。所以我雙重檢查我的PYTHONPATH:
$ python
import sys
for i in sys.path:
... print i
這給了這樣的輸出:
/home/...
/usr/local/lib/python2.7/site-packages
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/dist-packages
/home/.../venv/lib/python2.7
/home/.../venv/lib/python2.7/plat-x86_64-linux-gnu
/home/.../venv/lib/python2.7/lib-tk
/home/.../venv/lib/python2.7/lib-old
/home/.../venv/lib/python2.7/lib-dynload
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/home/.../venv/local/lib/python2.7/dist-packages
/home/.../venv/lib/python2.7/site-packages
/home/.../venv/local/lib/python2.7/dist-packages
在目錄中,我用...
的路徑表示我的項目/工作目錄。
在我看來,我真正需要做的是確保在我的虛擬環境中,/usr/
路徑不顯示。但我該怎麼做?我如何清除這些無關的路徑?