[英]Import Error in zope.interface.registry in python
I am installing a project in virtual environment. 我正在虚拟环境中安装项目。 I am getting error
我收到了错误
from zope.interface.registry import Components
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named registry
Version of this module as 4.0.5 该模块的版本为4.0.5
>>> import pkg_resources
>>> pkg_resources.get_distribution("zope.interface").version
'4.0.5'
I tried the same on my machine (not virtual env), 我在我的机器上尝试了相同的操作(不是虚拟环境),
>>> import pkg_resources
>>> pkg_resources.get_distribution("zope.interface").version
'4.0.1'
>>> from zope.interface.registry import Components
Here from zope.interface.registry import Components
didn't give any error. 这里
from zope.interface.registry import Components
没有给出任何错误。 According to this 根据这个
QUOTE: 3.8.0 (2011-09-22)
New module zope.interface.registry. This is code moved from
zope.component.registry which implements a basic nonperistent component registry
as zope.interface.registry.Components.
, it should not give any error. ,它不应该给出任何错误。 Any suggestion what I'm missing here or how to solve this error ?
有什么建议我在这里缺少或如何解决这个错误?
I had similar error - I tryed to create new virtual env without site-packages. 我有类似的错误 - 我试图创建没有站点包的新虚拟环境。 It creates all fine.
它创造了一切美好。 But my ubuntu has already installed
zope.interface
for own use, so it did not want to install it additional to my venv. 但是我的ubuntu已经安装了
zope.interface
供自己使用,所以它不想在我的venv之外安装它。
This collision cause my venv to throw error in simple test app under mod_wsgi: 这个碰撞导致我的venv在mod_wsgi下的简单测试应用程序中抛出错误:
from zope.interface.registry import Components
ImportError: No module named registry
So I trying to remove zope.interface
from base python. 所以我试图从基础python中删除
zope.interface
。 But unistall command not removed it(i found in google, that it is known problem). 但unistall命令没有删除它(我发现在谷歌,它已知问题)。
Than i found solution: I just switched to my venv and give command for "upgrading" zope.interface
from there: 比我找到的解决方案:我刚刚切换到我的venv并命令从那里“升级”
zope.interface
:
(env)user@ubuntu:~/env$ sudo pip install --upgrade zope.interface
After this my problem with zope.interface
dissmiss. 在此之后我的
zope.interface
问题解决了。
Your problem is similar, so my solution could help. 您的问题类似,所以我的解决方案可以提供帮助。 Anyway this answer is very useful for ubuntu desktop users.
无论如何,这个答案对于ubuntu桌面用户非常有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.