Cannot Read numpy From libpgm

扶醉桌前 提交于 2020-01-06 19:25:06

问题


I installed libpgm1.3. The documentation of libpgm1.1 is here: http://pythonhosted.org/libpgm/index.html (I could not find any documentation of 1.3). Then executed the code below.

import numpy
import libpgm
import libpgm.pgmlearner

The console gave me an error message.

File "test_libpgm.py", line 3, in <module>
    import libpgm.pgmlearner
File "/usr/local/lib/python3.5/dist-packages/libpgm/pgmlearner.py", line 35
    raise ImportError, "numpy is not installed on your system."
                     ^
SyntaxError: invalid syntax

This means the code can import numpy in line 1, but failed in line 3. I checked pgmlearner.py here:

32: try:
33:     import numpy as np
34: except ImportError:
35:     raise ImportError, "numpy is not installed on your system."

Why cannot this import numpy? Could anyone solve this problem? I use python 3.5 on Ubuntu 16.04.

来源:https://stackoverflow.com/questions/37765410/cannot-read-numpy-from-libpgm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!