centos7 install python3 and ipython

The default system under CentOS7 comes with a version of python2.X. This version is dependent on many programs of the system, so it is not recommended to delete it. If you use the latest Python3, then we know that there is no impact between compiling and installing the source code package and the system default package. So you can install python3 and python2 to coexist.

View centos7's own python version

[ root@localhost ~]# python -V
Python 2.7.5[root@localhost ~]# pip -V
pip 19.0.3from/usr/lib/python2.7/site-packages/pip(python 2.7)

If there is no pip tool under the original python2 version, you can install the pip tool under the Python2 version first:

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip -V

Install ipython corresponding to python 2.7 version, here use pip tool to install:

[ root@localhost ~]# pip install ipython

Report an error, install the corresponding package

yum install python-devel libxslt-devel libffi-devel

Installation is complete, check ipython

[ root@localhost ~]# ipython -V
5.8.0[ root@localhost ~]# ipython
Python 2.7.5(default, Oct 302018,23:45:53) 
Type "copyright","credits" or "license"for more information.

IPython 5.8.0-- An enhanced Interactive Python.?-> Introduction and overview of IPython's features.%quickref -> Quick reference.
help      -> Python's own help system.
object?-> Details about 'object', use 'object??'for extra details.

In [1]:

Install python3

[ root@localhost src]# wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
[ root@localhost src]# tar xf Python-3.6.4.tgz 
[ root@localhost src]# cd Python-3.6.4[root@localhost Python-3.6.4]# ./configure --prefix=/usr/local/python3
[ root@localhost Python-3.6.4]# make && make install

Create soft connection

ln -sv /usr/local/python3/bin/python3 /usr/bin/python3
ln -sv /usr/local/python3/bin/pip3 /usr/bin/pip3

View

[ root@localhost ~]# pip3 -V
pip 9.0.1from/usr/local/python3/lib/python3.6/site-packages(python 3.6)[root@localhost ~]# python3 -V
Python 3.6.4

python3 install ipython

[ root@localhost ~]# pip3 install ipython

Create soft link

ln -sv /usr/local/python3/bin/ipython3 /usr/bin/ipython3

View

[ root@localhost ~]# ipython -V
5.8.0[ root@localhost ~]# ipython3 -V
7.4.0

Because yum uses python2, it may not work properly after replacing it with python3, continue to use this python2.7.5

Therefore modify the yum configuration file (vi /usr/bin/yum).

Change the #!/usr/bin/python in the header of the file to #!/usr/bin/python2.7, save and exit.

Recommended Posts

centos7 install python3 and ipython
CentOS7 install python3 and pip3
CentOS 6.9 compile and install python
Centos6 install python3 pip3 ipython3
CentOS 6 compile and install python 3
Centos7 install Python 3.6.
CentOS install Python 3.6
Centos7 install Python2.7
Centos install Python3
CentOS6.8 install python2.7
CentOS quickly install Python3 and pip3
Install Python3 and ansible under CentOS8
Install Python3 and Py under CentOS7
Install centos7 and connect
Know Linux and install CentOS
CentOs7.3 compile and install Nginx 1.9.9
CentOS 7 install Mono and MonoDevelop
ubuntu18.04 compile and install python3.8
CentOS6.5 install Java 8 and Tomcat8
Centos compile and install Git
Centos 6.10 reinstall python and yum
Centos6.5 install and configure mongodb
CentOS7 install OracleJDK and JRE
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack Jira 7
CentOS6.5 install Java 8 and Tomcat8
Centos7 compile and install ntp-4.2.8p11
CentOS6 install and crack confluence
CentOS6 install and crack Jira 7
CentOS + Python3.6+
1.5 Install Centos7
Centos 7.5 python3.6
Centos 7 install jdk and package service service
Install and configure keepalived under CentOS 5.9
CentOS Yum compile and install MySQL 5.6
CentOS 6.x compile and install Nginx
CentOS7 compile and install L(A|N)MP environment
CentOS7.3 install iptables and detailed use
How to install Python 3.8 on CentOS 8
CentOS7 yum install and start mysql
CentOS 8 - install and configure NFS service
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos7 uninstall openJdk, and install JDK1.8
How to install Python on CentOS 8
Install and use docker under CentOS 6.8
CentOS7 install and use SQL Server
Configure python3 environment on centos7 and
CentOS Minimal install and configure TIPS
Install and configure FreeIPA in Centos7
Linux CentOS6 compile and install Pyt
virtualBox install centos, and build tomcat
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Compile and install libmodbus library under CentOS7
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
CentOS7 install MySQL
ubuntu18.04 install python2
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS