Upgrade Python on Mac Ox to 3.4

Source: Internet
Author: User

1th Step: Download Python3.4

As follows:

Download mac OS X 64-bit/32-bit Installer
https://www.python.org/downloads/release/python-340/


2nd Step: Install

Installing the downloaded DMG file

3rd Step: Configure

[Plain]View Plaincopy
  1. #!/bin/bash
  2. #python版号需要修改两个地方
  3. #1. New_version
  4. #sudo-I. #得到超级权限
  5. New_version= "3.4"
  6. pypath=/system/library/frameworks/python.framework/versions/"$new _version"
  7. #第1步移动新版python到mac默认目录下
  8. echo "Move ..."
  9. mv/library/frameworks/python.framework/versions/"$new _version"/system/library/frameworks/python.framework/ versions/
  10. #第2步改变用户目录的用户组
  11. echo "Chown ..."
  12. Chown-r Root:wheel ${pypath}
  13. #第3步 Delete the original 2.7 link
  14. echo "Del.."
  15. Rm/system/library/frameworks/python.framework/versions/current
  16. #第4步重新链接到最新版本的python
  17. echo "Ln.."
  18. Ln-s ${pypath}/system/library/frameworks/python.framework/versions/current
  19. #第5步删除旧的命令符号链接
  20. echo "rm.."
  21. Rm/usr/bin/{pydoc,python,pythonw,python-config}
  22. echo "Ln bin ..."
  23. #第6步重新建立新的命令符号链接
  24. Ln-s ${pypath}/bin/pydoc "$new _version"/usr/bin/pydoc
  25. Ln-s ${pypath}/bin/python "$new _version"/usr/bin/python
  26. Ln-s ${pypath}/bin/pythonw "$new _version"/usr/bin/pythonw
  27. Ln-s ${pypath}/bin/python "$new _version" M-config/usr/bin/python-config
  28. Python_param_list= ' Cd/usr/local/bin && ls-al |grep "Python" |awk ' ors= "" {Print $9} '
  29. #第7步修复其他链接
  30. For I in $python _param_list;do
  31. echo "INFO: $i"
  32. Rm-f/usr/local/bin/${i}
  33. ln-sv/system/library/frameworks/python.framework/versions/"$new _version"/bin/${i}/usr/local/bin/${i}
  34. Done
  35. #第8步. Environment variables to be modified to the latest version number
  36. echo ' Export Path=/system/library/frameworks/python.framework/versions/3.4/bin:${path} ' >> ~/.BASHRC
  37. Exit #退出超级权限


View current Python version

[HTML]View Plaincopy
      1. [email protected] ~$ python--version
      2. Python 3.4.0

Upgrade Python on Mac Ox to 3.4

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.