问题标签 [twisted.words]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - from twisted.words.protocols import irc no module named words.protocols
我正在尝试使用扭曲库创建一个简单的 irc 客户端,并从导入相关模块开始:
显示此错误:
我不太明白这个错误,因为我可以直接导入 tiwsted(它在我的 PATH 中),文件系统是这样的:
words 和protocols 文件夹都包含一个__init__.py
文件,因此它们应该被解释为模块。
如果我更改 /usr/local/lib/python2.7/dist-packages/twisted/words/ 的目录并启动 python 解释器,则此命令运行时不会出错:
但是我的最终脚本在这个目录中没有任何关系:/
我不太明白为什么会出现此错误以及如何解决它。
非常感谢您的帮助
编辑
我将所有单词都放入/usr/local/lib
而不是经典文件夹中/usr/lib
,也许python是查看第二个文件夹而不是第一个文件夹。
我还不知道如何重载这种行为,并希望它不会归结为os.environ['PATH']
看起来很脏的覆盖。
EDIT2:/usr/local/lib 文件夹属于 PATH,如以下命令所示:
所以我还是不明白为什么这个狗屎不打算进口
编辑3
我猜这与脚本名称无关;从我的 debian 终端: