“Importerror:没有命名的模块zope.接口“,但我已经在Centos 7上安装了

2024-05-15 01:46:40 发布

您现在位置:Python中文网/ 问答频道 /正文

enter image description here

为什么我不能运行这个代码?我已经有了zope.接口我试着更新路径,但还是不起作用,我不知道为什么。见上图:

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

Tags: 代码fromimport路径clientzopeastwisted
1条回答
网友
1楼 · 发布于 2024-05-15 01:46:40

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

为了解决这个问题,我会尝试如下符号链接:

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

相关问题 更多 >

    热门问题