在解压numpy安装包后,进入解压包运行python setup.py install命令时出现

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

需要先安装python-dev即:sudo apt-get install python-dev

之后运行python setup.py install命令成功。但运行from numpy import * 出现

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 intepreter from there. 

这是因为没有退出numpy解压包。退出后运行from numpy import * 成功。

Logo

更多推荐