我在装有 CentOS Linux 7.3.1611(核心)操作系统的计算机上使用 Python 3.5.1。
我必须安装 numpy
包。
我试着关注 these instructions ,通过运行命令:
sudo yum -y install python34-setuptools
不幸的是,我收到以下错误:
Transaction check error:
file /usr/lib64/libpython3.so from install of python34-libs-3.4.5-4.el7.x86_64 conflicts with file from package python3-libs-3.3.2-12.el7.nux.x86_64
关于如何解决这个问题的任何想法?谢谢
编辑:在我的机器上,我有 Python2.7 和 Python3.5,我想同时保留它们
最佳答案
它们应该是用 Centos OS 预编译的,所以试试:
sudo yum install numpy scipy
。
所以你有两个选择,第一个是在系统范围内安装它,就像我提到的那样,它们是用 Centos OS 预编译的,所以你可以用 numpy安装完整的
像这样:scipy
包
sudo yum install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
或者你可以使用pip来安装,像这样:
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
请阅读 scipy 组织的官方文档,了解如何 install您系统上的所有软件包。
注意:
你是对的,系统范围的安装只会为 python2.7
安装它,所以要将它用于 python3.5
,你将通过 pip< 安装
,所以这样做:
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
我建议您安装所有这些软件包,安装后我打开终端并执行了以下操作:
copser@copser-LIFEBOOK-S751:~$ python3.5
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import numpy as np
>>> import numpy.f2py as myf2py
>>>
如您所见,我在 python3.5.2
中导入了 numpy,它正在运行,我使用的是 Ubuntu 16.04
,它在 Centos OS 上应该是相同的。
关于Python3,如何在CentOS 7上安装numpy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47316178/