Update Python under MacBook

Source: Internet
Author: User
Tags macbook

#!/usr/bin/The Bash#python version needs to be modified in two places #1. new_version#sudo-I #得到超级权限new_version="3.4"Pypath=/system/library/frameworks/python.framework/versions/"$new _version"#第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 linkEcho "del.."RM/system/library/frameworks/python.framework/versions/current# 4th step relink to the latest version of PythonEcho "Ln.."LN-S ${pypath}/system/library/frameworks/python.framework/versions/current# The 5th step to delete the old command symbolic linkEcho "rm.."RM/usr/bin/{pydoc,python,pythonw,python-Config}Echo "Ln Bin:"#第6步重新建立新的命令符号链接LN-S ${pypath}/bin/pydoc"$new _version"/usr/bin/PydocLN-S ${pypath}/bin/python"$new _version"/usr/bin/pythonLN-S ${PYPATH}/BIN/PYTHONW"$new _version"/usr/bin/pythonwLN-S ${pypath}/bin/python"$new _version"m-config/usr/bin/python-configpython_param_list= ' Cd/usr/local/bin &&ls-al |grep "Python"|awk 'ors= "" {Print $9}'' #第7步修复其他链接 forIinch$python _param_list; Do  Echo "Info: $i"  RM-f/usr/local/bin/${i}LN-sv/system/library/frameworks/python.framework/versions/"$new _version"/bin/${i}/usr/local/bin/${i} Done#第8步. Environment variables to be modified to the latest version numberEcho 'Export Path=/system/library/frameworks/python.framework/versions/3.4/bin:${path}'>> ~/. Bashrcexit #退出超级权限

Update Python under MacBook

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.