Centos7 install Python 3.6.

One, centos7 install Python3.6.5 tutorial

1、 Before installing Python, you need to install some dependency problems encountered later (if there are dependency problems, follow the instructions to install):

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

 yum install xz gcc zlib zlib-devel wget sqlite-devel openssl-devel -y

2、 Download the Python source code package from the official website

Download link: https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz

After the download is complete, upload the source code package to the server

3、 unzip files:

xz -d Python-3.6.5.tar.xz

tar -xvf Python-3.6.5.tar.xz

Note: Unzip the Python file to the /usr/ folder.

4、 Go to the file directory

cd Python-3.6.5

5、 Start to install and compile Python

. /configure --prefix=/usr/Python-3.6.5 

Execute the make command (wait for compilation, about five or six minutes)

Execute the make install command (waiting for compilation and installation)

An error occurred during the installation process, the zlib package needs to be installed

     yum -y install zlib*

After installing zlib*, recompile

    make install

6、 Allow Centos7 system to use Python 3.6 by default

    cd /usr/bin/

mv python python.bak #Backup the original file

ln -s /usr/Python-3.6.5/bin/python3.6 /usr/bin/python (pay attention to the case of the first letter of the file)

(Note: ln -s source file, target file as soft link)

7、 Test whether Python 3.6.5 is installed successfully

8、 Because the Python2 used by the yum source is replaced with Python3, it will not work properly. The following information needs to be modified:

Modify yum configuration file:

    vi /usr/bin/yum

Change the head of the file #!/usr/bin/python to #!/usr/bin/python2.7

9、 Normal when testing yum:

    yum -y install vim

Prompt error, need to modify the following information:

    vi /usr/libexec/urlgrabber-ext-down

Change /usr/bin/python to /usr/bin/python2.7

10、 Test again if yum is normal

    yum -y install vim

The above steps are the actual operation documents for installing Python 3.6.5 on Centos7.

Two, Centos7 install Ipython 6.1.0

1、 Installation dependent environment

yum install xz gcc zlib zlib-devel wget sqlite-devel openssl-devel -y

2、 Download the ipython installation package

Installation package download address:

wget https://pypi.python.org/packages/79/63/b671fc2bf0051739e87a7478a207bbeb45cfae3c328d38ccdd063d9e0074/ipython-6.1.0.tar.gz#md5=1e15e1ce3f3f722da6935d7ac0e51346

Prompt that wget tool is not installed, use yum to install wget tool

     yum -y install wget

Continue to download the ipython installation package

2、 Install ipython

   tar xf ipython-6.1.0.tar.gz 

   cd ipython-6.1.0

Use Python to install ipython (provided that Python is installed)

    python setup.py install

3、 Test whether ipython is installed successfully

If such an error occurs, it means that the environment variable is set incorrectly. The modification method is as follows:

alias ipython='python -m IPython'

4、 Prompt the above error, you need to install all missing modules through pip until ipython runs successfully:

Prompt that the'traitlets' module is missing, install the actual module through pip

    pip3 install traitlets

5、 Download and install pip

Install the extension source: yum -y install epel-release

Install the Python-pip module: yum install python-pip

    ln -sv /usr/Python-3.6.5/bin/pip3 /usr/bin/pip3

6、 Install traitlets module

     pip install traitlets

7.      pip3 install pygments

8.   pip3 install pexpect

9.     pip3 install pickleshare

10.     pip3 install prompt_toolkit

11.      pip3 install simplegeneric

12. Test ipython again:

**Summary: **

I wasted a lot of time in the process of pip installation. I kept prompting -bash: pip3: command not found. I found many methods on the Internet, but it didn't work. Finally, the soft link was created successfully.

Through this installation, we know: During the installation process, you should search more for any problems you encounter, and you will surely find a solution.

Recommended Posts

Centos7 install Python 3.6.
CentOS install Python 3.6
Centos7 install Python2.7
Centos install Python3
CentOS6.8 install python2.7
CentOS + Python3.6+
1.5 Install Centos7
Centos 7.5 python3.6
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.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
CentOS7 upgrade python3
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
ubuntu12.04 install python3
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Python - centos6 installation
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS quickly install Python3 and pip3
How to install Python 3.8 on CentOS 8
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
How to install Python on CentOS 8
Install Python3 and ansible under CentOS8
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS8 install fastdfs6.06
CentOS 7 install Gitlab
Centos 7 install PostgreSQL
CentOS7 install MySQL8