为什么我不能运行这段代码?我已经有 zope.interface 我已经尝试更新路径但仍然不起作用,我不知道为什么。见上图:
import paho.mqtt.client as mqtt
from twisted.internet import reactor, protocol
from txws import WebSocketFactory
import json
请您参考如下方法:
如果您使用 pip 安装,它很可能会破坏安装。
After installing the zope module using pip, for example: z3c.password, your zope installation breaks.
This is because pip installs the module in
/usr/local/lib/python2.7/dist-packages/zopeand the original module zope.interface is in/usr/share/pyshared/zope/interface/and has minor relevance when importing.
要解决这个问题,我会尝试像这样对其进行符号链接(symbolic link):
cd /usr/local/lib/python2.7/dist-packages/zope
sudo ln -s /usr/share/pyshared/zope/interface/
