选择egg安装的Python版本或安装并行版本的site-package
通过fink install
,我在 Mac OS X 计算机上安装了以下 Python 版本:
python2.3
、python2.4
、python2。 5、
python2.6
。
此外,python
是我系统上 python2.6
的别名。
您能否告诉我,是否以及如何并行安装
networkx-0.36-py2.5
和networkx-1.0rc1-py2.6
?如何以可用于不同 Python 版本的方式安装站点包?
Via fink install
I put the following Python version on my Mac OS X computer:
python2.3
,python2.4
,python2.5
,python2.6
.
Further, python
is alias for python2.6
on my system.
I want to install an egg, e.g.
easy_install networkx-0.36-py2.5.egg
, where I have to use python 2.5 instead of version 2.6. Is this possible without changing thepython
alias?Can you tell me, whether and how I can install
networkx-0.36-py2.5
andnetworkx-1.0rc1-py2.6
in parallel?How can I install a site-package in a way, that it is available for different Python versions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
easy_install
是setuptools
包的一部分。Fink
具有适用于 python 2.5 和 python 2.6 的单独setuptools
软件包:然后您可以下载并安装
networkx
到这两个版本:如果您需要特定版本包装的:
easy_install
is part of thesetuptools
package.Fink
has separatesetuptools
packages for python 2.5 and python 2.6:You can then download and install
networkx
to both versions:If you need a particular version of the package:
编辑:阅读在阅读本文之前,Ned Deily 的回答
1.
在我的系统上,每个 python 版本都有不同的 easy_install 脚本:
2.6 版本的内容如下所示:
现在,如果您的计算机上还没有这些脚本,您可以使用上述内容作为模板来创建它们。只需更改第一行,使其指向正确的 python 解释器。可能是这样的:
并更改第三行以匹配当前脚本名称;意思是,如果脚本名为 easy_install-2.3,那么它应该如下所示:
当然,如果您没有使用 setuptools 版本 0.6c9,那么您也必须更改它。
另一种方法是运行 easy_install 脚本作为正确 python 版本的参数。像这样:
2.
每个Python版本都有不同的site-lib,因此它们是相互独立的。您可以为不同的 python 版本安装不同的模块和版本
3.
您可以使环境变量 PYTHONPATH 指向一个公共目录,或者将一个公共目录添加到您的 sys.path 中。脚本。但请注意,某些模块仅适用于某些 python 版本,并且包含必须为每个 python 版本编译的 C 代码...
Edit: Read Ned Deily's answer before you read this one
1.
On my system I have different easy_install script for each python version:
The contents of the 2.6 version looks like this:
Now, if you not already have those scripts on you machine, you could create those by using the above as template. Just change the first line so it points to the right python interpreter. Probably something like:
And change the third line to match the current script name; meaning, if the script is called easy_install-2.3, then it should look like this:
And of course if you are not using setuptools version 0.6c9 than you will have to change this, too.
An alternative is to run the easy_install script as an argument of the right python version. Like this:
2.
Each python version has a different site-lib, so they are independent from each other. You can install different modules and versions for different python versions
3.
You could make the env variable PYTHONPATH point to a common directory or add a common directory to sys.path in your scripts. But be aware that some modules work only with certain python versions and include C code that has to be compiled for each python version...