在 linux red hat 上安装 numpy 的错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13061379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error of install numpy on linux red hat
提问by runner frank
I am trying to install numpy from http://www.scipy.org/Download.
我正在尝试从http://www.scipy.org/Download安装 numpy 。
by git clone git://github.com/numpy/numpy.git numpy
经过 git clone git://github.com/numpy/numpy.git numpy
But, when I ran python setup.py install
但是,当我跑 python setup.py install
I got:
我有:
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel
Where to get python-dev ?
从哪里获得 python-dev ?
I tried:
我试过:
$ easy_install python-devel
Searching for python-devel
Reading http://pypi.python.org/simple/python-devel/
Couldn't find index page for 'python-devel' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for python-devel
error: Could not find suitable distribution for Requirement.parse('python-devel')
and
和
$ easy_install python-dev
Searching for python-dev
Reading http://pypi.python.org/simple/python-dev/
Couldn't find index page for 'python-dev' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for python-dev
error: Could not find suitable distribution for Requirement.parse('python-dev')
Any help will be appreciated.
任何帮助将不胜感激。
In order to solve the problem of python-dev, I have installed python2.6 in my local dir.
为了解决python-dev的问题,我在本地目录下安装了python2.6。
But, when I used python setup.py install --user to install numpy ,
但是,当我使用 python setup.py install --user 安装 numpy 时,
I got:
我有:
$ python setup.py install --user
$ python setup.py install --user
'import site' failed;
“导入站点”失败;
use -v for traceback Traceback (most recent call last): File "setup.py", line 18,
使用 -v 进行回溯 Traceback(最近一次调用最后一次):文件“setup.py”,第 18 行,
in import os ImportError:
在导入操作系统导入错误中:
No module named os
没有名为 os 的模块
in python2.6
在python2.6中
I got: >>> import os Traceback (most recent call last): File "", line 1, in ImportError: No module named os
我得到:>>> import os Traceback(最近一次调用最后一次):文件“”,第 1 行,在导入错误中:没有名为 os 的模块
Any help will be appreciated. thanks
任何帮助将不胜感激。谢谢
The following links are not helpful because I do not have root right and cannot use sudo.
以下链接没有帮助,因为我没有 root 权限并且无法使用 sudo。
回答by Kevin
python-dev is not a python module. Actually it's "Header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications." You can install it through Synaptic Package Manager,Software Center or yum.
python-dev 不是 python 模块。实际上它是“用于构建 Python 模块、扩展 Python 解释器或在应用程序中嵌入 Python 的头文件、静态库和开发工具”。您可以通过 Synaptic Package Manager、软件中心或 yum 安装它。
回答by Honghe.Wu
If you are in Ubuntu(e.g. Ubuntu 12.04), it is very easy,
如果您使用的是 Ubuntu(例如 Ubuntu 12.04),这很容易,
sudo apt-get install python-numpy
or you can compile from source through pip(I think on RedHat almost the same):
或者你可以通过 pip 从源代码编译(我认为在 RedHat 上几乎相同):
sudo apt-get install python-dev
sudo apt-get install python-pip
pip install numpy
回答by Gank
On CentOS, the python development libraries are under the name python-devel, not python-dev.
在 CentOS 上,python 开发库的名称是 python-devel,而不是 python-dev。
Use sudo yum install python-devel
to install them on your CentOS system.
使用 sudoyum install python-devel
在你的 CentOS 系统上安装它们。