Python upgrade python3.5.2 in Day1-Centos6.6 step, centos upgrade python3.5
[root@template ~]# python -v# /usr/lib64/python2.6/encodings/utf_8.pyc matches /usr/lib64/python2.6/encodings/utf_8.pyimport encodings.utf_8 # precompiled from /usr/lib64/python2.6/encodings/utf_8.pycPython 2.6.6 (r266:84292, Jan 22 2014, 09:42:36) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2Type "help", "copyright", "credits" or "license" for more information.dlopen("/usr/lib64/python2.6/lib-dynload/readline.so", 2);import readline # dynamically loaded from /usr/lib64/python2.6/lib-dynload/readline.so>>> exit()
Official Python3.5.2 website
Https://www.python.org/downloads/source/
Steps to upgrade to python3.5
Root @ template ~] # Cd/home/nulige/tools/# download python-3.5.2 [root @ template tools] # wget plugin tools] # ll total usage 20104-rw-r -- r -- 1 root 20566643 June 26 05:47 Python-3.5.2.tgz # unzip to the download directory [root @ template tools] # tar zxvf Python-3.5.2.tgz [root @ template tools] # ll total usage 20108drwxrwxr-x 16 1000 1000 June 26 05:38 Python-3.5.2-rw-r -- r -- 1 root 4096 june 26: 47 Python-3.5.2.tgz-rwxrwxrwx. 1 root 13259 May 8 16:10 system_optimize_scripts.sh # enter the decompressed folder [root @ template tools] # cd Python-3.5.2 # create a folder python3 (python installation path, to avoid overwriting the Old Version) [root @ template Python-3.5.2] # mkdir/usr/local/python3 # start compiling and installing [root @ template Python-3.5.2] #. /configure -- prefix =/usr/local/python3make & make installchecking build system type... x86_64-unknown-linux-gnucheckin G host system type... x86_64-unknown-linux-gnuchecking for -- enable-universalsdk... nochecking for -- with-universal-archs... nochecking MACHDEP... linux intermediate steps are omitted ............ checking for -- without-gcc... noconfigure: creating. /config. statusconfig. status: creating Makefile. preconfig. status: creating Modules/Setup. configconfig. status: creating Misc/python. pcconfig. status: creating Misc/python-config.sh Config. status: creating Modules/ld_so_aixconfig.status: creating pyconfig. hcreating Modules/Setupcreating Modules/Setup. localcreating Makefile [root @ template Python-3.5.2] # The intermediate steps of make & make install are omitted ............ if test "x "! = "X"; then \ rm-f/usr/local/python3/bin/python3-32; \ (cd/usr/local/python3/bin; ln-s python3.5-32 python3-32) \ firm-f/usr/local/python3/share/man/man1/python3.1 (cd/usr/local/python3/share/man/man1; ln-s python3.5.1 python3.1) if test "xupgrade "! = "Xno"; then \ case upgrade in \ upgrade) ensurepip = "-- upgrade"; \ install | *) ensurepip = ""; \ esac ;\. /python-E-m ensurepip \ $ ensurepip -- root =/; \ fiIgnoring ensurepip failure: pip 8.1.1 requires SSL/TLS [root @ template Python-3.5.2] # echo $? 0: Compilation completed ##################################### ########### the old version is not overwritten at this time, change the original/usr/bin/python link to another name [root @ template Python-3.5.2] # mv/usr/bin/python/usr/bin/python_old # and create a new version of python. [root @ template Python-3.5.2] # ln-s/usr/local/python3/bin/python3/usr/bin/python # the new version of python is displayed. [root @ template Python-3.5.2] # pythonPython 3.5.2 (default, aug 2 2016, 11:35:06) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on l InuxType "help", "copyright", "credits" or "license" for more information. >>> exit () # <---- exit pythonPS: If python3 is directly installed by default instead of creating a new installation path, the new python after installation will overwrite the old version that comes with linux, it may not be overwritten. For details, refer to the installation process. You can try it yourself. Of course, if you want to keep the original version, this method is best. Note: although this method can be successfully installed, yum cannot be used normally. Solution: [root @ template tools] # cp/usr/bin/yum. backup_2016-08-02 modify the first line parameter vi/usr/bin/yum put #! /Usr/bin/python:/usr/bin/python_old or #! /Usr/bin/python:/usr/bin/python2.6 # view the version [root @ template Python-3.5.2] # python -- versionPython 3.5.2