[使用 Mac OSX 10.6.8]
我正在尝试将 NetworkX 安装到 Python 2.7,但它一直在尝试将其安装到 2.6 版(当我升级到 2.7 时已卸载)
我尝试easy_install未指定的版本,它得到了 2.6 版本
命令:
easy_install网络X
输出
Searching for networkx
Best match: networkx 1.7
Processing networkx-1.7-py2.6.egg
Removing networkx 1.7 from easy-install.pth file
Adding networkx 1.7 to easy-install.pth file
Using /Library/Python/2.6/site-packages/networkx-1.7-py2.6.egg
Processing dependencies for networkx
Finished processing dependencies for networkx
smms-baldrick:20121205_coif kirstin$
我尝试下载Python 2.7版本并直接安装它,但它仍然进入了2.6的库
命令:
easy_install http://networkx.lanl.gov/download/networkx/networkx-1.7-py2.7.egg
输出
Downloading http://networkx.lanl.gov/download/networkx/networkx-1.7-py2.7.egg
Processing networkx-1.7-py2.7.egg
removing '/Library/Python/2.6/site-packages/networkx-1.7-py2.7.egg' (and everything under it)
creating /Library/Python/2.6/site-packages/networkx-1.7-py2.7.egg
Extracting networkx-1.7-py2.7.egg to /Library/Python/2.6/site-packages
networkx 1.7 is already the active version in easy-install.pth
Installed /Library/Python/2.6/site-packages/networkx-1.7-py2.7.egg
Processing dependencies for networkx==1.7
Finished processing dependencies for networkx==1.7
在 Unix 变体中,easy_install 还安装了一个带后缀的链接,所以应该有一个 easy_install-2.7 .一般来说,知道你安装新 Python 的确切位置,并使用这些知识来安装安装工具,然后使用easy_install,这可能是一个好主意。例如:
$ cd to/my/setuptools/
$ sudo /my/new/python2.7 setup.py install
之后
$ /my/new/easy_install-2.7 networkx
然后,您可以创建一组符号链接。此外,由于Mac在内部使用python,因此最好不要弄乱默认的python安装,而是使用自己的与virtualenv之类的东西(这将自动安装setuptools)。
您为特定的 Python 安装安装 easy_install。然后,该easy_install将安装到安装了easy_install的 Python 安装中。
如果要使用 easy_install 将软件包安装到另一个 Python 安装中,您必须做的第一件事就是在该 Python 安装中安装easy_install。然后,您可以使用该easy_install来安装软件包。
您可能还想改用 pip。
另请参阅:安装Python及其模块和包的新手提示。
我设法安装了这个软件包
python -m easy_install networkx
从如何使用特定的 Python 版本运行easy_install
[为我的默认 Python 安装调用了易安装]
但我可以用一个更长期的解决方案来改变我的默认版本的易安装