安装python numpy

来源:互联网 发布:网络通信平台 编辑:程序博客网 时间:2024/06/05 02:10

1.研究python-nltk时,需要安装numpy。 

采用下面的命令安装失败: $sudo pip install -U numpy ... 

  File "numpy/core/setup.py", line 410, in generate_config_h 
    moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)   File "numpy/core/setup.py", line 41, in check_types     out = check_types(*a, **kw) 
  File "numpy/core/setup.py", line 271, in check_types     "Cannot compile 'Python.h'. Perhaps you need to "\ 
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel. ---------------------------------------- 

Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-root/numpy Storing complete log in /root/.pip/pip.log  


解决方法: 

可以通过gui安装:system>administration>add/remove software>search numpy and install it. 

也可以试试用sudo yum install numpy安装。  

yum search 

yum search numpy 


Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile  * base: mirrors.btte.net  * extras: mirrors.btte.net  * updates: mirrors.btte.net 
============================== N/S Matched: numpy ============================== numpy-f2py.x86_64 : f2py for numpy 
numpy.x86_64 : A fast multidimensional array facility for Python  

  Name and summary matches only, use "search all" for everything.


2.安装python模块时出现:error: Setup script exited with error: command 'gcc' failed with exit status 1

yum install python-devel

0 0
原创粉丝点击