在自定义 python 上使用 easy_install 安装时出现问题
我有一个 mac osx 因此我有机器附带的普通 python 以及我下载的新版本,并且运行得很好。这是在
$ which python
/Library/Frameworks/Python.framework/Versions/2.6/bin/python
Easy_install 中仅适用于标准版本:
$ which easy_install
/usr/bin/easy_install
所以我下载了 setuptools-0.6c11-py2.6.egg 然后
$ cd Downloads/
$ sudo sh setuptools-0.6c11-py2.6.egg
Password:
Processing setuptools-0.6c11-py2.6.egg
Copying setuptools-0.6c11-py2.6.egg to /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installing easy_install-2.6 script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installed /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
这似乎可以工作,
$ which easy_install
/Library/Frameworks/Python.framework/Versions/2.6/bin/easy_install
但有些东西仍然不起作用:
$ easy_install pymongoSearching for pymongo
Reading http://pypi.python.org/simple/pymongo/
Reading http://github.com/mongodb/mongo-python-driver
Best match: pymongo 1.9
Downloading http://pypi.python.org/packages/source/p/pymongo/pymongo-1.9.tar.gz#md5=12e12163e6cc22993808900fb9629252
Processing pymongo-1.9.tar.gz
Running pymongo-1.9/setup.py -q bdist_egg --dist-dir /var/folders/vm/vmoE5XqwH-yKiaMzAQS1vE+++TI/-Tmp-/easy_install-lRHv7W/pymongo-1.9/egg-dist-tmp-xFybXs
warning: no files found matching '*.h' under directory 'pymongo'
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
from bson/_cbsonmodule.c:23:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
from pymongo/_cmessagemodule.c:23:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
from bson/_cbsonmodule.c:23:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
zip_safe flag not set; analyzing archive contents...
Adding pymongo 1.9 to easy-install.pth file
error: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/easy-install.pth: Permission denied
然后当我继续使用 python 时,我
import pymongo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pymongo
是什么我做错了吗?
非常感谢!
I have a mac osx As such I have the normal python that comes with the machine, and the new version that I have downlaoded, and that works very well. This is in
$ which python
/Library/Frameworks/Python.framework/Versions/2.6/bin/python
Easy_install was only working on the standard version:
$ which easy_install
/usr/bin/easy_install
So I downloaded setuptools-0.6c11-py2.6.egg and then
$ cd Downloads/
$ sudo sh setuptools-0.6c11-py2.6.egg
Password:
Processing setuptools-0.6c11-py2.6.egg
Copying setuptools-0.6c11-py2.6.egg to /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installing easy_install-2.6 script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installed /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
This seemed to work,
$ which easy_install
/Library/Frameworks/Python.framework/Versions/2.6/bin/easy_install
but something is still not working:
$ easy_install pymongoSearching for pymongo
Reading http://pypi.python.org/simple/pymongo/
Reading http://github.com/mongodb/mongo-python-driver
Best match: pymongo 1.9
Downloading http://pypi.python.org/packages/source/p/pymongo/pymongo-1.9.tar.gz#md5=12e12163e6cc22993808900fb9629252
Processing pymongo-1.9.tar.gz
Running pymongo-1.9/setup.py -q bdist_egg --dist-dir /var/folders/vm/vmoE5XqwH-yKiaMzAQS1vE+++TI/-Tmp-/easy_install-lRHv7W/pymongo-1.9/egg-dist-tmp-xFybXs
warning: no files found matching '*.h' under directory 'pymongo'
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
from bson/_cbsonmodule.c:23:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
from pymongo/_cmessagemodule.c:23:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
from bson/_cbsonmodule.c:23:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
zip_safe flag not set; analyzing archive contents...
Adding pymongo 1.9 to easy-install.pth file
error: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/easy-install.pth: Permission denied
And then when I go on python and I
import pymongo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pymongo
What am I doing wrong?
Many thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须使用 root 权限运行
easy_install
。You have to run
easy_install
with root privileges.您是否尝试这样做:
easy_install pymongo
?当你在 IDLE 中导入 pymongo 时会返回什么?
Did you try doing just :
easy_install pymongo
??What would that return when you import pymongo in IDLE?
虽然有点晚了,但我在 OSX 10.6.7 上成功执行了以下操作:
然后:
A little late to the game, but I had success doing the following on OSX 10.6.7:
then: