我在MacOS上使用Homebrew安装的Python 2.7.14。我该如何阻止这种情况发生?:
$ virtualenv --no-site-packages venv
New python executable in /private/tmp/venv/bin/python2.7
Also creating executable in /private/tmp/venv/bin/python
Installing setuptools, pip, wheel...done.
$ . venv/bin/activate
(venv) $ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
我的期望
$ env -i PATH=/tmp/venv/bin pip --version
pip 9.0.1 from /private/tmp/venv/lib/python2.7/site-packages (python 2.7)
编辑:解决方案相关Why does virtualenv inherit $PYTHONPATH from my shell?
答案 0 :(得分:1)
unset PYTHONPATH