系统,PIP和Virtualenv上的Python 2.7仍使用2.6-如何将它们切换为使用2.7 [英] Python 2.7 on System, PIP and Virtualenv still using 2.6 - How do I switch them to use 2.7
问题描述
我在MacOSx 10.6.8上,并且安装了python 2.7
I am on MacOSx 10.6.8 and I have python 2.7 installed
python -v产生:
python -v produces:
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
我跑了:
$ virtualenv venv
然后
$ . venv/bin/activate
然后执行python -v
and do a python -v
我得到:
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/Users/nkhdev/venv/lib/python2.6/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /Users/nkhdev/venv/lib/python2.6/lib-dynload/readline.so
有人可以告诉我在我的系统中使用virtualenv创建和使用python 2.7的步骤吗?或拥有virtualenv,请使用python 2.7期间.我不在乎该版本是否是我的系统版本.
Can someone tell me the steps to use have virtualenv create and use python 2.7 from my system? Or have virtualenv, use python 2.7 period. I don't care if the version is my system version.
推荐答案
您可能使用了Apple提供的现有easy_install
版本来安装pip
等.默认情况下,easy_install
与Python的特定实例相关联,在这种情况下,此实例为Apple提供的系统Python 2.6.通常,当您安装新版本的Python时,还需要为其安装新的easy_install
.按照此处的说明中的说明,提供提供easy_install
的Distribute软件包,然后使用它来安装pip
并使用该pip
安装virtualenv
.
You probably used an existing, Apple-supplied version of easy_install
to install pip
et al. By default, easy_install
is associated with a particular instance of Python, in this case, the Apple-supplied system Python 2.6. In general, when you install a new version of Python, you need to also install a new easy_install
for it. Follow the instructions here for the Distribute package which provides easy_install
, then use it to install pip
and use that pip
to install virtualenv
.
这篇关于系统,PIP和Virtualenv上的Python 2.7仍使用2.6-如何将它们切换为使用2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!