当我在任何项目中收到回溯错误时,我注意到,跟踪中的文件路径显示了一个我不再使用的特定项目。例如:
File "/Users/MyComputer/Developer/SampleApp/venv/lib/python2.7/site-packages/flask/app.py"...
我假设网站套餐不是来自SampleApp,对吗?我在所有项目中都使用虚拟环境。当我在激活的虚拟环境中运行echo $PATH
时,我得到:
/Users/MyComputer/Developer/SampleApp/venv/bin: #<----- Shouldn't point to a specific project!
/Library/Frameworks/Python.framework/Versions/3.5/bin:
/Users/MyComputer/bin/:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/git/bin:
/Users/MyComputer/.rvm/bin:
/Applications/Postgres.app/Contents/Versions/9.4/bin
当我在停用虚拟环境中运行echo $PATH
时,我会在没有/Users/MyComputer/Developer/SampleApp/venv/bin
的情况下获得上述内容。
以下是./bashrc
:
export PATH=$PATH:$HOME/usr/local/bin
export PATH=$PATH:$HOME/usr/bin/env
这是.bash_profile
中的内容:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
# Postgres.app
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
为什么激活的venv路径与已停用的env路径不同?先感谢您! :)