Mac OS X 中的 virtualenv 问题

Problem with virtualenv in Mac OS X(Mac OS X 中的 virtualenv 问题)
本文介绍了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 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How can I read system information in Python on Windows?(如何在 Windows 上读取 Python 中的系统信息?)
How to get the newest directory in Python(如何在 Python 中获取最新目录)
Python - Get Path of Selected File in Current Windows Explorer(Python - 在当前 Windows 资源管理器中获取所选文件的路径)
Print out the whole directory tree(打印出整个目录树)
Python os.stat and unicode file names(Python os.stat 和 unicode 文件名)
A system independent way using python to get the root directory/drive on which python is installed(使用 python 获取安装 python 的根目录/驱动器的系统独立方式)