AttributeError'module'对象没有属性'__path__' - 使用virtualenv时出错

时间:2014-02-26 11:21:42

标签: python python-3.x virtualenv

我有一个名为'process.py'的简单python脚本。用Python3编写。

我已成功设置了virtualenv。该脚本使用pymongo所以我有pip-3.3安装pymongo确定。

现在我跑

>python process.py

我收到以下神秘错误:

File "<frozen importlib._bootstrap>", line 1519, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

...

File "process.py", line 3, in <module>
   import pymongo.errors.ConfigurationError as ConfigurationError
ImportError: No module named 'pymongo.errors.ConfigurationError'; pymongo.errors is not a package

这是脚本的顶部:

import pymongo
import pymongo.errors.ConfigurationError as ConfigurationError
import xml.etree.ElementTree as etree

....

我是Python的新手。我真的不知道这里发生了什么。疯狂的是,4周前一切都运转良好!

感谢所有人的帮助。感谢。

0 个答案:

没有答案