Python multi-version coexistence and switchover using pyenv under Mac

Source: Internet
Author: User

Mac python2.7 cannot be removed, because many system modules rely on, so we use pyenv to install the python3.6 version, so that can coexist.

1. Install OS X's Suite manager (like Ubuntu Apt-get),

The website is as follows: http://brew.sh/index_zh-cn.html
Or install directly with terminal commands

/usr/bin/ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"


2, install PYENV, command as follows:
Brew Update
Brew Install Pyenv
VI. bash_profile
Add the following content:

Export pyenv_root=/usr/local/var/pyenvif which pyenv >/dev/null; Then eval "$ (pyenv init-)"; Fi

source. bash_profile


3. Install Python
Now we can look at the version of Python that can be installed
Pyenv install-l
We choose to install the latest 3.6.2
Pyenv Install 3.6.2
The database needs to be updated after installation is complete
Pyenv Rehash
To view the installed version of the system:
Pyenv versions
* Indicates the version currently being used by the system and can be seen on
Python view discovery is still version 2.7

Toggle Python Version
Pyenv Global 3.6.2
Pyenv versions
Confirm that the Python version is switched


Enter Python to use the new version of Python;

The system comes with a script that calls the old version of Python directly in a/usr/bin/python way, so it doesn't affect system scripting.



This article is from the "Adrenaline" blog, please be sure to keep this source http://lizitong.blog.51cto.com/12914119/1968592

Python multi-version coexistence and switchover using pyenv under Mac

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.