[英]Python importing/finding a package with a period in the name
Using Ubuntu 14.04. 使用Ubuntu 14.04。
I'm installing someone else's python program, and encountering some trouble in installation and running it. 我正在安装别人的python程序,在安装和运行它时遇到了一些麻烦。
They have an install shell script; 他们有一个安装shell脚本; and it currently runs completely through.
并且目前完全运行。
When I run the executable python program 'dwgui', i get an error on the line: 当我运行可执行的python程序'dwgui'时,在行上出现错误:
File "./dwgui", line 6, in <module>
from dw.gui.dw_gui import MainWindow
ImportError: No module named dw.gui.dw_gui
The install shell script is very verbose, and it's output indeed says: install shell脚本非常冗长,其输出确实显示:
copying build/lib.linux-x86_64-2.7/dw/gui/dw_gui.py -> /home/ubuntu/.local/lib/dw/gui
and then: 接着:
byte-compiling /home/ubuntu/.local/lib/dw/gui/dw_gui.py to dw_gui.pyc
so there is a dw/gui/dw_gui.pyc file. 因此有一个dw / gui / dw_gui.pyc文件。 (I checked) Is there any way to get that dw.gui.dw_gui package to import and be used?
(我检查过)有什么方法可以导入并使用该dw.gui.dw_gui软件包?
您需要确保/home/ubuntu/.local/lib/
目录位于PYTHONPATH环境变量上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.