Mac OS X中的virtualenv问题 [英] Problem with virtualenv in Mac OS X

查看:139
本文介绍了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  

我该如何修复?

谢谢.

推荐答案

如果您继续遇到virtualenv的问题,则可以尝试 pythonbrew 代替.它是解决同一问题的另一种方法.它的工作方式更像Ruby的 rvm :它在$HOME/.pythonbrew下构建并创建Python的整个实例,然后设置了一些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问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆