Mac OS X 中的 virtualenv 问题

时间:2023-04-26
本文介绍了Mac OS X 中的 virtualenv 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我已经通过 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 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:PyGame os.environ SDL_VIDEO_WINDOW_POS 不起作用 下一篇:如何使用 Python 将目录及其内容复制到现有位置

相关文章

最新文章