我正在尝试用easy_install安装一个新模块。
当我运行这样的命令时
sudo easy_install foofoo被安装到~/Library/Python/2.7/site-packages/中。
这似乎是错误的,因为我不能在python中使用任何已安装的模块。
根据我在阅读了一些与easy_install相关的帖子之后所理解的,正确的目录应该是/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages,因为我的python使用了象征性地链接到该目录的/usr/local/bin/python。
如何告诉easy_install使用此目录而不是当前目录?
谢谢,
朱利安
编辑:i用选项-d /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages重新运行setuptools安装。产出如下:
Processing setuptools-0.6c11-py2.7.egg
Removing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
setuptools 0.6c11 is already the active version in easy-install.pth
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Installing easy_install-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11例如,sudo easy_install mechanize的输出是
Searching for mechanize
Best match: mechanize 0.2.5
Processing mechanize-0.2.5-py2.7.egg
mechanize 0.2.5 is already the active version in easy-install.pth
Using /Users/julian/Library/Python/2.7/site-packages/mechanize-0.2.5-py2.7.egg
Processing dependencies for mechanize
Finished processing dependencies for mechanizeeasy_install似乎还在使用错误的目录?!我们非常感谢你的帮助。谢谢。
发布于 2012-11-16 01:03:39
结果发现我的道路出了问题。移动/usr/local/share/python到我的路径顶端,通过自制重新安装python解决了我的问题。
如果问题仍然存在,一定要尝试运行brew doctor并遵循建议!
发布于 2012-03-11 21:29:07
您可以使用-前缀来设置要安装包的路径。或者将/Library/ python /2.7/site-packages/添加到python路径中。
发布于 2012-03-11 21:29:39
要做到这一点,一种方法是安装setuptools(它有easy_install),用于您试图使用的python。因此,使用您的符号链接python,遵循这些指示,然后,在/Library/Frameworks/Python.framework/Versions/2.7/Scripts中使用easy_install而不是~/Library/Python/2.7/Scripts
https://stackoverflow.com/questions/9659018
复制相似问题