Akbar Pandu
Akbar Pandu

Reputation: 51

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

enter image description here

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

Upvotes: 2

Views: 1205

Answers (1)

Sam Gomena
Sam Gomena

Reputation: 1479

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/

Upvotes: 1

Related Questions