1
[email protected]:~/Documents/MongoDB$ python2
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo import Connection
>>>
[email protected]:~/Documents/MongoDB$ python3
Python 3.1.2 (r312:79147, Sep 27 2010, 09:45:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo import Connection
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pymongo
问题>我不知道为什么pymongo不能用我的python 3.任何想法?为什么pymongo不能使用python3,它只能与python2兼容
//基于此的更新OP解决方案可帮助之下//
首先,仍然不明白为什么这个帖子得到了反对票!
第一步>http://pypi.python.org/pypi/pymongo3#downloads
二>下载pymongo3-1.9b1.tar.gz
步骤3>通过使用tar xzf pymongo3-1.9b1.tar.gz
第四步> CD pymongo3将它解压缩-1.9b1
第五步>须藤python3 setup.py安装
如果你按照上面的所有指示,pymongo应该准备好 你P3 :)
您还需要针对Python 3的不同包:http://pypi.python.org/pypi/pymongo3 –
链接已死亡。无论如何,因为@Rafe Kettler说你需要python3 mongodb。在Ubuntu中使用:'pip3 install [package-name]'来安装p3软件包。仅使用'pip install'会默认安装p2软件包。 – bpile