系统 python 与用户 python
我已经使用 macports 安装了 Python 2.7,并且由于我的 $PATH 变量,这就是我输入 $ python 时得到的变量。然而,virtualenv 默认使用 Python 2.6,除非我记得使用 -p 标志强制它这样做。
与此相关的是,全局运行 yolk -l 显示以下内容:
Python - 2.6.1 - active development (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload)
所以我的问题是,我应该做些什么来确保系统始终使用 MacPorts 的 Python 2.7,还是不值得担心 Apple 的 Python 2.6.1 显然在混合?
I've installed Python 2.7 using macports and because of my $PATH variable, that's the one I get when I type $ python. However, virtualenv defaults to using Python 2.6 unless I remember to force it to do otherwise with the -p flag.
On a related note, globally running yolk -l shows the following:
Python - 2.6.1 - active development (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload)
So my question is, should I do something to ensure the system is always using MacPorts' Python 2.7 or is it not worth worrying that Apple's Python 2.6.1 is apparently in the mix?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你在系统上全局强制使用 python 2.7,事情就会崩溃。你不想那样做。
您应该使用 virtualenvwrapper。它应该选择你喜欢的Python。
http://www.doughellmann.com/docs /virtualenvwrapper/install.html#python-interpreter-virtualenv-and-path
If you force python 2.7 globally on your system, things will break. You don't want to do that.
You should use virtualenvwrapper. It should choose your preferred python.
http://www.doughellmann.com/docs/virtualenvwrapper/install.html#python-interpreter-virtualenv-and-path
我也遇到过类似的问题,尽管与 virtualenv 没有具体关系。我发现,在使用 macports 安装特定版本的 python 并将该版本设置为默认版本后,安装基于 macports 构建或使用 python 的第 3 方模块解决了所有问题。本质上,您最终会在不同版本的 python 之上进行并行构建。我有几个,并使用 python_select 在它们之间切换。另外,请参阅此处了解如何让 easy_install 与你的新 python 一起使用。
I have had similar problems, although not related specifically to
virtualenv
. I found that, after installing a particular version of python with macports, and having that version set as default, installing 3rd party modules that are build on or use python using macports solved all problems. You essentially end up with parallel builds, on top of different versions of python. I have a few, and switch between them usingpython_select
. Also, see here on SO for how to get easy_install to work with your new python.