[英]Import Error in zope.interface.registry in python
我正在虛擬環境中安裝項目。 我收到了錯誤
from zope.interface.registry import Components
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named registry
該模塊的版本為4.0.5
>>> import pkg_resources
>>> pkg_resources.get_distribution("zope.interface").version
'4.0.5'
我在我的機器上嘗試了相同的操作(不是虛擬環境),
>>> import pkg_resources
>>> pkg_resources.get_distribution("zope.interface").version
'4.0.1'
>>> from zope.interface.registry import Components
這里from zope.interface.registry import Components
沒有給出任何錯誤。 根據這個
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.
,它不應該給出任何錯誤。 有什么建議我在這里缺少或如何解決這個錯誤?
我有類似的錯誤 - 我試圖創建沒有站點包的新虛擬環境。 它創造了一切美好。 但是我的ubuntu已經安裝了zope.interface
供自己使用,所以它不想在我的venv之外安裝它。
這個碰撞導致我的venv在mod_wsgi下的簡單測試應用程序中拋出錯誤:
from zope.interface.registry import Components
ImportError: No module named registry
所以我試圖從基礎python中刪除zope.interface
。 但unistall命令沒有刪除它(我發現在谷歌,它已知問題)。
比我找到的解決方案:我剛剛切換到我的venv並命令從那里“升級” zope.interface
:
(env)user@ubuntu:~/env$ sudo pip install --upgrade zope.interface
在此之后我的zope.interface
問題解決了。
您的問題類似,所以我的解決方案可以提供幫助。 無論如何,這個答案對於ubuntu桌面用戶非常有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.