In Centos 6.4, the system installs Python The version is 2.6.6, and the latest version is 3.3.5, so we plan to upgrade it.
Note that if the default code is GB18030, please change it to LANG="en_US. UTF-8", otherwise the compilation will fail! One click operation:
yum install zlib zlib - devel gcc gcc - c ++ openssl openssl - devel libffi - devel - y
zero
one
two
three
four
five
six
seven
eight
nine
ten
eleven
#Libffi devel
wget https : //www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar zxf Python - 3.6.5.tgz
cd Python - 3.6.5
. / configure -- prefix =/ opt / Python - 3.6.5 -- enable - optimizations
make
make install
cd / opt / Python - 3.6.5 / bin
for i in ` ls - l | awk '{print $9}' | grep - v "^$" ` ; do ln - s / opt / Python - 3.6.5 / bin / $ i / usr / local / bin / $ i ; done
cd / opt
python3 . six - m venv py3
source / opt / py3 / bin / activate
SourceByrd's Weblog- https://note.t4x.org/system/centos-update-python/
Operation process:
zero
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
[ root @ WWW Byrd ] # wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tgz
[ root @ WWW Byrd ] # tar zxvf Python-3.3.5.tgz
[ root @ WWW Byrd ] # cd Python-3.3.5
[ root @ WWW Python - 3.3.5 ] # mkdir /usr/local/python3
[ root @ WWW Python - 3.3.5 ] # ./ configure --prefix=/usr/local/python3
[ root @ WWW Python - 3.3.5 ] # make
[ root @ WWW Python - 3.3.5 ] # make install
[ root @ WWW Python - 3.3.5 ] # mv /usr/bin/python /usr/bin/python_old
[ root @ WWW Python - 3.3.5 ] #ln -s /usr/local/python3/bin/python3 /usr/bin/python
[ root @ WWW Python - 3.3.5 ] # python
Python 3.3.5 ( default , Mar thirteen two thousand and fourteen , 09 : 08 : forty-one )
[ GCC 4.4.7 twenty million one hundred and twenty thousand three hundred and thirteen ( Red Hat 4.4.7 - four ) ] on linux
Type "help" , "copyright" , "credits" or "license" for more information .
> > >
SourceByrd's Weblog- https://note.t4x.org/system/centos-update-python/
If yum reports an error, refer to: http://note.t4x.org/system/file-yum-except-keyboardinterrupt/ SourceByrd's Weblog- https://note.t4x.org/system/centos-update-python/
Statement: This article is original by BYRD (based on Centos6.4 X64), and reprinting without permission is prohibited! SourceByrd's Weblog- https://note.t4x.org/system/centos-update-python/
SourceByrd's Weblog- https://note.t4x.org/system/centos-update-python/