简体   繁体   中英

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

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/zope and the original module zope.interface is in /usr/share/pyshared/zope/interface/ and has minor relevance when importing.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM