CentOS development environment configuration Python3

CentOS7 configuration Python3.7 development environment

1
2
3
4
5
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz


tar -zxvf Python-3.7.3.tgz

2. Installation tools

1
2
3
4
5
6
7
8
yum install -y gcc


yum -y groupinstall "Development tools"

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libffi-devel


3. Compile install Python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mkdir / usr / local / python3 
# Create a directory to python3

cd Python-3.7.3 /
# to enter the just-extracting installation package python directory

--prefix = ./configure / usr / local / python3
# generate makefile document, the installation directory where you want to make just their new catalog

make
# use the make command to compile a wave

the make the Test
# check there are no errors

install the make
# installation

Big Box   CentOS configuration Python3 development environment tp: //qiniuyun.tiny777.com/blog/20190413/a1xLx9B0vC8x.png "alt =" mark ">

See this even if the installation was successful friends.

4. Create a soft link

1
2
3
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3

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

5. Modify the default version python and yum

Since this time the default python or before the built-in version 2.x, so we have to change it

1
2
3
4
5
rm / usr / bin / python 
soft connection python2 before deleting #

-s LN / usr / local /python3/bin/python3.7 / usr / bin / python
# Create a soft link to the python

mark

Since yum default is python2, this time certainly will not be able to modify the run, we need to yum configuration file also changed a bit

1
2
LL / usr / bin / | grep python 
# First we look at the installation of python

mark

From the figure we can see that this computer is installed python2.7 and python3.7, pointing to the default python is 3.7.

1
2
Vim / usr / bin / yum 
# into the python line corresponding to the first version, illustrated as python2.7

mark

1
2
Vim / usr / libexec / urlgrabber-EXT-Down 
# same as above, and also where the operation

Finally input respectively yum, python, python2, python3, pipand other commands check

mark

Guess you like

Origin www.cnblogs.com/liuzhongrong/p/11961128.html