切换到32位Python后,虚拟环境在OSX上无法使用
我从python.org下载了官方的DMG安装包,重新安装了Python 2.7,因为我需要使用一个预编译的二进制文件,但这个文件在我的64位Python安装上运行不正常。
(对我来说,把它重新编译成64位太难了,所以这不是一个选择)
安装成功了,Python的Mac安装程序会修复所有的链接,所以我现在的Python安装是32位的。但是我之前用64位Python创建的所有虚拟环境现在都不能用了,输出信息如下:
dyld: Library not loaded: @executable_path/../.Python
Referenced from: /Users/dom/django/.virtualenvs/lepoc/bin/python
Reason: no suitable image found. Did find:
/Users/dom/django/.virtualenvs/lepoc/bin/../.Python: no matching architecture in universal wrapper
/Users/dom/django/.virtualenvs/lepoc/bin/../.Python: no matching architecture in universal wrapper
Trace/BPT trap
有没有可能的解决办法(比如重新链接什么的),还是说我必须重新创建所有的虚拟环境?
1 个回答
3
我建议你重新创建它们。bin文件夹里的“python”可执行文件是一个程序,可能是针对你的电脑架构和/或特定的python版本制作的。你可以把所有已安装的python包保存下来,然后在新的虚拟环境中使用pip重新安装它们:
pip freeze -E lepoc > requirements.txt
pip install -E newve -r /path/to/pip-requirements.txt
另外,你可以查看这个链接了解更多信息:http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/