首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Virtualenv:没有名为虚拟包装器的模块,路径是错误的

Virtualenv:没有名为虚拟包装器的模块,路径是错误的
EN

Stack Overflow用户
提问于 2014-01-27 04:23:29
回答 1查看 844关注 0票数 1

为什么在安装了virtualenv和virtualenvwrapper之后添加了

代码语言:javascript
运行
复制
    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,我遇到:

代码语言:javascript
运行
复制
    /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看起来像:

代码语言:javascript
运行
复制
    # 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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-02 19:49:12

所以就想通了。原来,当我在一段时间前为python安装了EPD时,它增加了前几行:

代码语言:javascript
运行
复制
    # 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之后,我需要将这些行更改为:

代码语言:javascript
运行
复制
   # set path for current python
   PATH="/Users/<user>/Library/Enthought/Canopy_64bit/User/bin:${PATH}"
   export PATH

现在一切都正常了。然而,事实证明,这在一天结束时是行不通的,因为它支持venv,这是一种关于这里的python 3标准。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21372983

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档