CENTOS7 Python3.7安装numpy

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 <module>
    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 "<stdin>", line 1, in <module>
  File "/home/pi/my/python370_package/numpy-1.15.2/numpy/__init__.py", line 131, in <module>
    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 <module>
    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 "<stdin>", line 1, in <module>
  File "/home/pi/my/python370_package/numpy-1.15.2/numpy/__init__.py", line 131, in <module>
    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,也会报错

 

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