The following error occurred when I try to run a python script called math.py
in the Desktop/math
folder, which is a mathematical symbol classifier:
stupid-idiot:math likunshu$ python math.py
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "math.py", line 3, in <module>
import torch
File "/Users/likunshu/anaconda/lib/python3.6/site-packages/torch/__init__.py", line 53, in <module>
from torch._C import *
ValueError: module functions cannot set METH_CLASS or METH_STATIC
Then in the same shell, I typed ipython
, and successfully import torch like this:
In [1]: import torch
In [2]: torch.__path__
Out[2]: ['/Users/likunshu/anaconda/lib/python3.6/site-packages/torch']
I’ve googled it on the Internet and tried many solutions but nothing worked. Does anyone have some ideas about how to solve this problem?
My Python version is 3.6.1 and Anaconda version is 4.4.0