Import Error in zope.interface.registry in python

喜夏-厌秋 提交于 2019-12-10 14:47:42

问题


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

>>> 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. 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 ?


回答1:


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.

This collision cause my venv to throw error in simple test app under mod_wsgi:

     from zope.interface.registry import Components
ImportError: No module named registry

So I trying to remove zope.interface from base python. But unistall command not removed it(i found in google, that it is known problem).

Than i found solution: I just switched to my venv and give command for "upgrading" zope.interface from there:

(env)user@ubuntu:~/env$ sudo pip install --upgrade zope.interface

After this my problem with zope.interface dissmiss.

Your problem is similar, so my solution could help. Anyway this answer is very useful for ubuntu desktop users.



来源:https://stackoverflow.com/questions/15610423/import-error-in-zope-interface-registry-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!