为什么在安装了virtualenv和virtualenvwrapper之后添加了
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /Users/<user>/Library/Enthought/Canopy_64bit/User/bin/virtualenvwrapper.sh对于我的.bash_profile和运行$ source ~/.bash_profile,我遇到:
/Library/Frameworks/Python.framework/Versions/7.3/Resources/Python.app/Contents/MacOS/Python: No module named virtualenvwrapper
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=/Library/Frameworks/Python.framework/Versions/Current/bin/python and that PATH is set properly.我的.bash_profile看起来像:
# Setting PATH for EPD_free-7.3-2
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH
##
# Your previous /Users/<user>/.bash_profile file was backed up as /Users/<user>/.bash_profile.macports-saved_2012-11-06_at_11:39:22
##
# MacPorts Installer addition on 2012-11-06_at_11:39:22: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /Users/<user>/Library/Enthought/Canopy_64bit/User/bin/virtualenvwrapper.sh
# Added by Canopy installer on 2014-01-26
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
VIRTUAL_ENV_DISABLE_PROMPT=1 source /Users/<user>/Library/Enthought/Canopy_64bit/User/bin/activate发布于 2014-02-02 19:49:12
所以就想通了。原来,当我在一段时间前为python安装了EPD时,它增加了前几行:
# Setting PATH for EPD_free-7.3-2
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH在我的.bash_profile里。在将我的python更新到Enthought之后,我需要将这些行更改为:
# set path for current python
PATH="/Users/<user>/Library/Enthought/Canopy_64bit/User/bin:${PATH}"
export PATH现在一切都正常了。然而,事实证明,这在一天结束时是行不通的,因为它支持venv,这是一种关于这里的python 3标准。
https://stackoverflow.com/questions/21372983
复制相似问题