Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python3, how to install numpy on CentOS 7?

I'm working with Python 3.5.1 on a computer having CentOS Linux release 7.3.1611 (Core) operating system.

I have to install the numpy package.

I tried to follow these instructions, by running the command:

sudo yum -y install python34-setuptools

Unfortunately, I got the following error:

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

Any idea on how to solve this problem? Thanks

EDIT: On my machine, I have both Python2.7 and Python3.5, and I want to keep them both

like image 798
DavideChicco.it Avatar asked Mar 07 '23 14:03

DavideChicco.it


1 Answers

They should come pre-compiled with Centos OS, so try with:

sudo yum install numpy scipy.

So you have two option fist one is installing it system wide, like I mentioned they are pre-compiled with Centos OS, so you can Install the complete scipy packages with numpy like this:

sudo yum install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Or you can use pip for the installation, like this:

python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

Please read the official docs from scipy organization on how to install all the packages on you system.

NOTE:

You are right that system wide installation will install it only for python2.7, so to use it for python3.5 you will install via pip, so do this:

sudo python3 -m pip install --upgrade pip

sudo python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

and I suggest that you install all of this packages, after the installation I've opened my terminal and I've did this:

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
>>> 

as you can see I've imported numpy inside python3.5.2 and it is working, I'm using Ubuntu 16.04 it should be the same on Centos OS.

like image 185
copser Avatar answered Mar 15 '23 13:03

copser