问题
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