开发者

Upgrading Python in Virtual Env

I have python 2.6.1 installed on Mac OS X. I wanted to play around with python 3开发者_开发百科.2, so i created a virtual enviromant using

virtualenv python3.0

and then activated it using

source python3.0/bin/activate

if I update the python in the virtualenv will it leave my system python untouched? If yes, do I just install python 3 using pip install?


When you create through

virtualenv python3.0

It creates a symlink in the virtual env folder bin directory :

lrwxr-xr-x   1 ---  ---     6 Aug 23 13:28 python2.6 -> python

So you can not do just pip install to upgrade python.

On mac osx, you can have multiple versions of python installed. In your case , install Python 3.0 and then use that version to call the virtualenv.

Python is installed in /usr/bin

-rwxr-xr-x  2 root  heel  86000 Feb 11  2010 python
-rwxr-xr-x  5 root  heel    925 Feb 11  2010 python-config
lrwxr-xr-x  1 root  heel     75 Aug 23 10:01 python2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
lrwxr-xr-x  1 root  heel     82 Aug 23 10:01 python2.5-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
lrwxr-xr-x  1 root  heel     75 Aug 23 10:01 python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x  1 root  heel     82 Aug 23 10:01 python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python

/usr/bin/python3.0 virtualenv yourenv.

This env will have a symlink for python 3.0


Use pythonbrew to experiment with different version of python on one system:

pythonbrew is a program to automate the building and installation of Python in the users $HOME.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜