简体   繁体   English

安装了各种版本的python的easy_install,mac osx

[英]easy_install with various versions of python installed, mac osx

I have various versions of python on a mac OSX 10.6 machine, some of them installed with macports: 我在mac OSX 10.6机器上有各种版本的python,其中一些安装了macports:

> python_select -l
Available versions:
current none python24 python26 python26-apple python27

The default or system version is python26-apple . 默认或系统版本是python26-apple I am now using python27, which I selected with 我现在正在使用我选择的python27

> sudo python_select python27

I recently tried installing django using easy_install , but it got installed with the default python (I can check that by python_selecting python26-apple and importing django). 我最近尝试使用easy_install安装django,但它安装了默认的python(我可以通过python_selecting python26-apple和导入django来检查)。 If, instead, I download the django tarball, expand and use 相反,如果我下载django tarball,请展开并使用

> sudo python setup.py install

everything works as expected, ie I get django in python 2.7. 一切都按预期工作,即我在python 2.7中得到django。 Now the question is, is there a way to get easy_install to work with the version of python I have selected with python_select ? 现在的问题是,有没有办法让easy_install使用我用python_select选择的python版本?

UPDATE Apparently python_select is deprecated. UPDATE显然不推荐使用python_select The following command seems to be equivalent: 以下命令似乎是等效的:

port select --list python

producing: 生产:

Available versions for python:
    none
    python24
    python26
    python26-apple
    python27 (active)

If you want your "easy_install" match your updated python version, follow these steps: 如果您希望“easy_install”与更新的python版本匹配,请按照下列步骤操作:

Download the corresponding .egg file at http://pypi.python.org/pypi/setuptools#files Run it as if it were a shell script: sh setuptools-0.6c9-py2.7.egg This will install the new "easy_install" executable, compatible with your current version of python. http://pypi.python.org/pypi/setuptools#files下载相应的.egg文件。运行它就好像它是一个shell脚本:sh setuptools-0.6c9-py2.7.egg这将安装新的“easy_install” “可执行文件,与您当前版本的python兼容。

Hope this helps. 希望这可以帮助。

(more details at http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other ) (更多详情请访问http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other

请务必在该shell脚本上使用-prefix =选项来控制easy_install版本所在的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM