Python Auto-Install python2.7

Source: Internet
Author: User

#coding = Utf-8import Osimport sysif (os.getuid () = = 0):p asselse:print ("is not root user") Sys.exit (1) #version = input ("Please input Python version (2.7/3.6)") Version = 2.7if Version = = 2.7:packagename = "Python-2.7.13" else:packagename = "Py thon-3.6.2 "Os.system (" RM-RF "+ packagename+" * ") if (Version = = 2.7): url =" https://www.python.org/ftp/python/2.7.13/ Python-2.7.13.tgz "elif Version = = 3.6:url =" https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz "Else:print (" Input error ") Sys.exit (1) cmd =" wget "+ urlres = Os.system (cmd) if res! = 0:print (" Download failed Check network ") cmd =" ta R XVF "+ PackageName +". tgz "res = os.system (cmd) if res! = 0:p rint (" Tar Failed ") Os.system (" rm "+ PackageName +". tgz ") sy S.exit (1) cmd = "CD Python-2.7.13 &&./configure--prefix=/usr/local/python2.7 && make && make INS Tall "res = Os.system (cmd) if res! = 0:os.system (" RM-RF "+ PackageName) Os.system (" rm "+ PackageName +". tgz ") Print (" Make Failed ") Sys.exit (1)

  

Python Auto-Install python2.7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.