CENTOS7 Python3.7安装numpy

转载 https://my.oschina.net/mengyoufengyu/blog/2250116

1、安装必要的依赖库

sudo yum install unzip
sudo yum install python-devel
sudo yum install epel-release
sudo yum install blas-devel lapack-devel
2、安装numpy

mkdir python370_package
cd python370_package
pip3.7 download numpy
unzip numpy-1.15.2.zip
cd numpy-1.15.2

python370 setup.py install

sudo reboot # 重启重启重启,否则进行测试就报错
python370
import numpy
3、过程中出现的错误:

(1)未重启出现的错误:

import numpy
Traceback (most recent call last):
File “/home/pi/my/python370_package/numpy-1.15.2/numpy/init.py”, line 126, in
from numpy.config import show as show_config
ModuleNotFoundError: No module named ‘numpy.config

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “/home/pi/my/python370_package/numpy-1.15.2/numpy/init.py”, line 131, in
raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.

from numpy.config import show as show_config
Traceback (most recent call last):
File “/home/pi/my/python370_package/numpy-1.15.2/numpy/init.py”, line 126, in
from numpy.config import show as show_config
ModuleNotFoundError: No module named ‘numpy.config

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “/home/pi/my/python370_package/numpy-1.15.2/numpy/init.py”, line 131, in
raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
(2)不安装blas-devel和lapack-devel,也会报错

你可能感兴趣的:(python,linux)