【问题标题】:venv Python uses incorrect sys.prefixvenv Python 使用不正确的 sys.prefix
【发布时间】:2013-08-01 02:52:13
【问题描述】:

我在 mac Mountain Lion 上运行 canopy 64 位版本:1.0.3.1262。我已经使用 easy_install 安装了 virtualenv。但是当我尝试执行命令时:

virtualenv venv --distribute

它显示以下错误:

Using base prefix '/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents'
New python executable in venv/bin/python
dyld: Library not loaded: @rpath/Python
Referenced from: /Users/xxx/Desktop/untitled folder 2/venv/bin/python
Reason: image not found
ERROR: The executable venv/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/Users/xxx/Desktop/untitled folder 2' (should be u'/Users/xxx/Desktop/untitled folder 2/venv')
ERROR: virtualenv is not compatible with this system or executable 

有没有人遇到过类似的问题并解决了?提前感谢您的宝贵建议。

【问题讨论】:

    标签: python virtualenv enthought


    【解决方案1】:

    Canopy 使用venv 而不是virtualenv

    尝试像这样设置您的环境:

    venv -s path/to/virtual_environment_dir
    

    取自:https://support.enthought.com/entries/21802240-Use-venv-not-virtualenv-with-Canopy-Python

    或者如果您想设置没有系统站点包的环境:Setting up a virtural enviroment (venv) with no system site packages

    【讨论】:

    • 我解决了这个问题。您还需要指定venv 的路径。
    • 所以命令应该是这样的:/Users/vessilli/Library/Enthought/Canopy_64bit/User/bin/venv flaskapp
    • @vessilli venv 应该自动指向该位置,您不需要包含完整路径
    • 可能是,但就我而言,它没有。
    猜你喜欢
    • 1970-01-01
    • 2016-05-12
    • 1970-01-01
    • 2020-10-11
    • 2018-12-23
    • 2021-09-13
    • 2021-10-04
    • 1970-01-01
    • 2020-04-18
    相关资源
    最近更新 更多