简体   繁体   English

“导入错误:没有名为 zope.interface 的模块”,但我已经安装在我的 Centos 7 上

[英]"Importerror: no module named zope.interface", but I already installed on my Centos 7

在此处输入图片说明

Why I cant run this code?为什么我不能运行这段代码? I already have zope.interface I have try update the path but still doesn't work, I don't know why.我已经有了 zope.interface 我尝试更新路径但仍然不起作用,我不知道为什么。 See the image above:见上图:

import paho.mqtt.client as mqtt
from twisted.internet import reactor, protocol
from txws import WebSocketFactory
import json

If you installed with pip there's a good chance it broke the installation.如果您使用 pip 安装,则很可能会破坏安装。

After installing the zope module using pip, for example: z3c.password, your zope installation breaks.使用 pip 安装 zope 模块后,例如:z3c.password,您的 zope 安装中断。

This is because pip installs the module in /usr/local/lib/python2.7/dist-packages/zope and the original module zope.interface is in /usr/share/pyshared/zope/interface/ and has minor relevance when importing.这是因为 pip 将模块安装在/usr/local/lib/python2.7/dist-packages/zope ,而原始模块 zope.interface 在/usr/share/pyshared/zope/interface/并且在导入时相关性很小.

To fix this I would try symlinking it like so:为了解决这个问题,我会尝试像这样符号链接它:

cd /usr/local/lib/python2.7/dist-packages/zope
sudo ln -s /usr/share/pyshared/zope/interface/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ImportError:没有名为zope.interface的模块 - ImportError: No module named zope.interface python importerror没有名为zope.interface的模块扭曲 - python importerror no module named zope.interface twisted ImportError:没有名为zope.interface的模块,但是找到了模块 - ImportError: No module named zope.interface but modules found ImportError:扭曲需要zope.interface 3.6.0或更高版本:实际上已经安装了 - ImportError: Twisted requires zope.interface 3.6.0 or later: actually it have been installed Django 中的 Zope.interface - Zope.interface in Django 为什么运行stratum mining proxy时会出现“ImportError:Twisted需要zope.interface 3.6.0或更高版本。” - Why do I get “ImportError: Twisted requires zope.interface 3.6.0 or later.” when running stratum mining proxy? 我不能在zope.interface中声明类型的属性吗? - Cannot I declare an attribute with type in zope.interface? ImportError: No module named xgboost and package already installed - ImportError: No module named xgboost and package already installed ImportError: No module named requests: 但它已经安装 - ImportError: No module named requests: But it is installed already ImportError: No Module named 6; 已经安装了六个 - ImportError: No Module named six; six already installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM