在Arch Linux的,安装后virtualenvwrapper系统范围内,通过sudo pip2 install virtualenvwrapper
和我的用户的.bash_profile中添加此,`这virtualenvwrapper.sh螺丝python`了在Arch Linux的
export WORKON_HOME=/home/myuser/.virtualenvs
export PROJECT_HOME=/home/myuser/work
source /usr/bin/virtualenvwrapper.sh
错误显示,每当我推出一个新的shell窗口: -
which: no python in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl)
-bash: : command not found
virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON= and that PATH is set properly.
这可以追溯到在virtualenvwrapper.sh脚本行50: -
47 # Locate the global Python where virtualenvwrapper is installed.
48 if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ]
49 then
50 VIRTUALENVWRAPPER_PYTHON="$(\which python)"
51 fi
并且是与使用python2 for python 2.7安装的arch linux约定相冲突的结果。
如果我将第50行修改为which python2
,一切正常,每当我启动一个新的shell时,我都不会看到错误消息。
解决此问题的适当方法是什么?我是否明确检查当前操作系统是否是arch linux,并引入if-else条件以使用virtualenvwrapper.sh中的哪个python2并将修补程序发送给virtualenvwrapper作者?还是有什么我可以用我的arch linux机器上的配置来做?
这是一个很好的答案,对我来说它比virtualenv更好。我只需要它,因此我只是在需要时创建链接,然后取消链接/ usr/local/bin/python – Ben 2014-10-10 05:48:55