**** Hello everyone, I'm Overlord Unarmor, I haven't updated my blog for a long time, today I'm bringing you the source code installation tutorial of centos python3! ! ! ! !
python official website: https://www.python.org/
Download the python3 package
Install yum source and epel source
Unzip the installation
[root@localhost a]# ls
Python-3.6.0.tgz
[root@localhost a]# tar -xf Python-3.6.0.tgz -C /usr/local/src/
[root@localhost a]# cd /usr/local/src/
[root@localhost src]# ls
Python-3.6.0
[root@localhost src]# cd Python-3.6.0/
[root@localhost Python-3.6.0]# sed -i 's/^#readline/readline/' Modules/Setup.dist
[root@localhost Python-3.6.0]# sed -ri 's/^#(_ssl)/\1/p' Modules/Setup.dist
[root@localhost Python-3.6.0]# sed -ri 's/^#([\t]-DUSE)/\1/p' Modules/Setup.dist
[root@localhost Python-3.6.0]# sed -ri 's/^#([\t]-L\$(SSL))/\1/p' Modules/Setup.dist
[root@localhost Python-3.6.0]# 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 gcc
[root@localhost Python-3.6.3]# ./configure --enable-shared --enable-optimizations
[root@localhost Python-3.6.3]# make -j 2 && make install
(-j is the number of cpus)
Configure shared library files
- First find the installation path of this file
-
Set shared library directory for all users
Open the configuration file with vi editor
/etc/profile
vi /etc/profile
Write the following at the end of the file:
python3.6 shared directory
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
test python3
Enter exit()
to exit python3.6
The above is the process of installing python. You can try it. If you have any questions, leave a message to me. Thank you! ! ! !