[英]"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.