在安装多个版本的Python时使用easy_install,Mac OS X
我在一台运行mac OSX 10.6的电脑上有多个版本的python,其中一些是通过macports安装的:
> python_select -l
Available versions:
current none python24 python26 python26-apple python27
默认的系统版本是python26-apple
。现在我在使用python27,这是我通过
> sudo python_select python27
选择的版本。我最近尝试用easy_install
安装django,但它却是用默认的python安装的(我可以通过选择python26-apple并导入django来检查这一点)。不过,如果我下载django的压缩包,解压后使用
> sudo python setup.py install
一切就能正常工作,也就是说我可以在python 2.7中使用django。现在的问题是,有没有办法让easy_install
与我通过python_select
选择的python版本一起工作呢?
更新 显然python_select
已经不再使用了。下面这个命令似乎可以达到同样的效果:
port select --list python
产生:
Available versions for python:
none
python24
python26
python26-apple
python27 (active)
2 个回答
1
记得在那个 shell 脚本里使用 -prefix= 这个选项,这样可以控制你安装的 easy_install 版本放在哪里。
9
如果你想让你的“easy_install”跟你更新后的Python版本匹配,可以按照以下步骤操作:
首先,去这个链接下载对应的 .egg 文件:http://pypi.python.org/pypi/setuptools#files。
然后,像运行一个脚本一样运行它:sh setuptools-0.6c9-py2.7.egg。
这样就会安装一个新的“easy_install”程序,它和你当前的Python版本是兼容的。
希望这能帮到你。
(更多详细信息可以查看这个链接:http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other)