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 问题


基础教程推荐
- 合并具有多索引的两个数据帧 2022-01-01
- 哪些 Python 包提供独立的事件系统? 2022-01-01
- 使用 Google App Engine (Python) 将文件上传到 Google Cloud Storage 2022-01-01
- 症状类型错误:无法确定关系的真值 2022-01-01
- 如何在 Python 中检测文件是否为二进制(非文本)文 2022-01-01
- Python 的 List 是如何实现的? 2022-01-01
- 使 Python 脚本在 Windows 上运行而不指定“.py";延期 2022-01-01
- 如何在Python中绘制多元函数? 2022-01-01
- 将 YAML 文件转换为 python dict 2022-01-01
- 使用Python匹配Stata加权xtil命令的确定方法? 2022-01-01