我一直试图让 python C 模块启动并运行。我正在从Here安装 deltaLDA 模块。我按照 REAMDE 文件中指定的说明进行操作。像往常一样,我写道:
sudo python setup.py install
我猜一切都按预期进行,我得到了这个输出:
running build
running build_ext
building 'deltaLDA' extension
C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC
creating build
creating build/temp.linux-i686-2.7
compile options: '-I/media/Hub/DropBox/Dropbox/Betazeta/Software/LDA/deltaLDA -I/usr/lib/pymodules/python2.7/numpy/core/include -I/usr/include/python2.7 -c'
extra options: '-O3 -Wall'
gcc: deltaLDA.c
In file included from /usr/include/python2.7/Python.h:8:0,
from deltaLDA.c:22:
/usr/include/python2.7/pyconfig.h:1155:0: warning: "_POSIX_C_SOURCE" redefined
/usr/include/features.h:214:0: note: this is the location of the previous definition
deltaLDA.c:686:1: warning: function declaration isn’t a prototype
creating build/lib.linux-i686-2.7
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-i686-2.7/deltaLDA.o -o build/lib.linux-i686-2.7/deltaLDA.so
running install_lib
copying build/lib.linux-i686-2.7/deltaLDA.so -> /usr/local/lib/python2.7/dist-packages
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/deltaLDA-0.1.1.egg-info
Writing /usr/local/lib/python2.7/dist-packages/deltaLDA-0.1.1.egg-info
但是当我尝试导入 deltaLDA 模块时,我收到以下错误:
>>> from deltaLDA import deltaLDA
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named deltaLDA
如果我使用 help('modules') 或 pip freeze 命令检查已安装的模块,我可以在两个列表中找到 deltaLDA,但我无法导入它。请任何帮助将不胜感激。
谢谢!
更新:
我还验证了 sys.path 并且'/usr/local/lib/python2.7/dist-packages'
它就在上面。如果我尝试从 deltaLDA 导入 * 就像from deltaLDA import *
我得到同样的错误。在解释器上也尝试dir(deltaLDA)
得到相同的“无模块名称”错误。也许 deltaLDA 模块有问题?有人可以尝试安装吗?
固定的
我检查了 dist 包上 .so 和 egg-info 文件的权限。它们不可读,我不知道为什么。我刚刚运行了一个 sudo chmod 777 文件,现在它正在工作!