ubuntu 18.04 python3.8 cuda10.2 Successfully installed torch torchvision. But when import torch reports an error:
ImportError: numpy.core.multiarray failed to import
Trying various methods on the Internet will not work. The source of the error is actually numpy instead of torch
# 错误复现
import numpy
# 解决: pip 和 numpy升级到最新版
$ sudo pip3 install pip -U
$ sudo pip3 install numpy -I
# 重新编译安装python3.8
$ cd ~/Downloads/Python-3.8.2
$ ./configure --enable-optimizations
$ sudo make -j8
$ sudo make install
Reason: Python was manually installed by the tgz package downloaded from the python official website. Not installed.
Reference: https://stackoverflow.com/questions/34051737/numpy-core-multiarray-failed-to-import