Problem with virtualenv in Mac OS X(Mac OS X 中的 virtualenv 问题)
问题描述
我已经通过 pip
安装了 virtualenv
并在创建新环境后出现此错误:
I've installed virtualenv
via pip
and get this error after creating a new environment:
selenium:~ auser$ virtualenv new
New python executable in new/bin/python
ERROR: The executable new/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/System/Library/Frameworks/Python.framework/ Versions/2.6' (should be '/Users/user/new')
ERROR: virtualenv is not compatible with this system or executable
在我的环境中:
PYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
PATH=/System/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
我该如何修复这个问题?
How can I repair this?
谢谢.
推荐答案
如果您仍然遇到 virtualenv
问题,您可以尝试 pythonbrew,而不是.这是同一问题的替代解决方案.它的工作方式更像 Ruby 的 rvm:它在 $HOME/下构建并创建一个完整的 Python 实例.pythonbrew
,然后设置一些 bash 函数,让您可以轻松地在版本之间切换.virtualenv
隐藏 Python 的系统版本,使用符号链接作为其解决方案的一部分,pythonbrew
构建完全独立的 Python 安装.
If you continue to have trouble with virtualenv
, you might try pythonbrew, instead. It's an alternate solution to the same problem. It works more like Ruby's rvm: It builds and creates an entire instance of Python, under $HOME/.pythonbrew
, and then sets up some bash functions that allow you to switch easily between versions. Where virtualenv
shadows the system version of Python, using symbolic links as part of its solution, pythonbrew
builds entirely self-contained installations of Python.
我多年来一直使用 virtualenv
.这是一个不错的解决方案,但我最近改用 pythonbrew
.拥有完全自包含的 Python 实例意味着安装新实例需要一段时间(因为 pythonbrew
实际上是从头开始编译 Python),但每个安装的自包含性质对我很有吸引力.而且磁盘很便宜.
I used virtualenv
for years. It's a decent solution, but I've switched to pythonbrew
lately. Having completely self-contained Python instances means that installing a new one takes awhile (since pythonbrew
actually compiles Python from scratch), but the self-contained nature of each installation appeals to me. And disk is cheap.
这篇关于Mac OS X 中的 virtualenv 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Mac OS X 中的 virtualenv 问题


基础教程推荐
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01