系统上的Python 2.7,PIP和Virtualenv仍在使用2.6 - 如何将它们切换为使用2.7

Nic*_*ick 7 python macos pip virtualenv

我在MacOSx 10.6.8上安装了python 2.7

python -v产生:

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
Run Code Online (Sandbox Code Playgroud)

我他们跑:

$ virtualenv venv
Run Code Online (Sandbox Code Playgroud)

然后

$ . venv/bin/activate
Run Code Online (Sandbox Code Playgroud)

并做一个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
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我使用virtualenv创建并使用我的系统中的python 2.7的步骤吗?或者有virtualenv,使用python 2.7时期.我不在乎版本是否是我的系统版本.

Ned*_*ily 5

您可能使用了现有的Apple提供的版本easy_install来安装pip等.默认情况下,easy_install与特定的Python实例相关联,在本例中为Apple提供的系统Python 2.6.通常,在安装新版本的Python时,还需要为其安装新版本easy_install.按照此处提供的Distribute软件包的说明进行操作easy_install,然后使用它来安装pip和使用它pip进行安装virtualenv.