Upgrade Python to the latest version on MAC

Source: Internet
Author: User

1th step: Download Python3.4 as follows: Download mac OS X 64-bit/32-bit installerhttps://www.python.org/downloads/release/python-340/2nd step: Install install download DMG File 3rd step: Configuration Create the following script, change the version number can be [plain] view plaincopy on code to see the chip derivation to my Code slice #!/bin/bash #python版号需要修改两个地方 #1. New_version #sudo-I #得到超级权限 new_version= "3.4" pypath=/system/library/frameworks/python.framework/versions/"$new _ve  Rsion "#第1步移动新版python到mac默认目录下 echo" Move ... " mv/library/frameworks/python.framework/versions/"$new _version"/system/library/frameworks/python.framework/  versions/#第2步改变用户目录的用户组 echo "Chown ..."  Chown-r root:wheel ${pypath} #第3步 Delete the original 2.7 link echo "Del ..."  Rm/system/library/frameworks/python.framework/versions/current #第4步重新链接到最新版本的python echo "Ln."  Ln-s ${pypath}/system/library/frameworks/python.framework/versions/current #第5步删除旧的命令符号链接 echo "rm ..."  Rm/usr/bin/{pydoc,python,pythonw,python-config} echo "Ln bin ..." #第6步重新建立新的命令符号链接 ln-s ${pypath}/bin/pydoc "$new _version"/usr/bin/pydoc ln-s ${pypath}/bin/python "$new _version"/Usr/bin/python ln-s ${pypath}/bin/pythonw "$new _version"/usr/bin/pythonw ln-s ${pypath}/bin/python "$new _version" M-config/usr/bin/python-config python_param_list= ' cd/usr/local/bin && ls-al |grep "python" |awk ' ORS= "" {p Rint $9} ' #第7步修复其他链接 for i in $python _param_list;do echo "info: $i" rm-f/usr/local/bin/${i} ln-sv/system/l  ibrary/frameworks/python.framework/versions/"$new _version"/bin/${i}/usr/local/bin/${i} done #第8步. Environment variable to be modified to the latest version number echo ' Export Path=/system/library/frameworks/python.framework/versions/3.4/bin:${path} ' >> ~/.BASHRC exit #   Exit Super Permission View current Python version [HTML] view plaincopy[email protected] ~$ python--version

Upgrade Python to the latest version on MAC

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.