Mac OS uses pyenv to manage Python multiple versions

Source: Internet
Author: User

1 Installing Pyenv

Brew Install Pyenv

2 Configuring ~/bash_profile

Export pyenv_root= "$HOME/.pyenv" Export path= "$PYENV _root/bin: $PATH" eval "$ (pyenv init-)"

3 Let the new configuration item take effect

SOURCE ~/.bash_profile

4 test if it is installed and view the version that can be installed

Pyenv install-l

5 Installing Python3

My current latest version of Python is 3.6.4. You can install it according to the latest version shown in the previous code.

Pyenv Install 3.6.4

6 switch version to 3.6.4

$ pyenv Global 2.7.3  # Sets the global Python version by writing the version number to the ~/.pyenv/version file. $ pyenv Local 2.7.3 # Sets the Python native version by writing the version number to the. python-version file in the current directory. The Python version set in this way has a higher priority than global.

7 printing the current Python version

Import Sys
Print (sys.version)
Print (Sys.version_info)

Mac OS uses pyenv to manage Python multiple versions

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.