在我的 ubuntu 12.04 机器上,我有几个其他脚本(使用 pymongo)在屏幕上运行良好。但是后来我尝试运行另一个脚本或者只是在 python 控制台中导入 pymongo 我得到了这个:
> >>> from pymongo import Connection
> Traceback (most recent call last): File "<stdin>", line 1, in <module> File
> "/usr/local/lib/python2.7/dist-packages/pymongo/__init__.py", line 60,
> in <module>
> from pymongo.connection import Connection File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line
> 39, in <module>
> from pymongo.mongo_client import MongoClient File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line
> 44, in <module>
> from bson.py3compat import b File "/usr/local/lib/python2.7/dist-packages/bson/__init__.py", line 27, in
> <module>
> from bson.dbref import DBRef File "/usr/local/lib/python2.7/dist-packages/bson/dbref.py", line 17, in
> <module>
> from copy import deepcopy File "copy.py", line 2, in <module>
> connection = pymongo.Connection('localhost', 27017) AttributeError: 'module' object has no attribute 'Connection'
> >>>
由于未知原因,导入已安装的模块失败。
虽然已经运行的脚本继续运行良好,但我无法启动任何使用 pymongo 的新脚本。
我在这里完全迷失了,不知道该怎么做(并且无法谷歌搜索任何有用的东西)。