Python Learning pyenv Tutorial

Source: Internet
Author: User
Tags git clone

Recommended for Yyuu/pyenv GitHub, which allows you to install as many Python versions as you like without modifying your system's own python, and that the versions are isolated from one another, and are easy to manage in multiple versions. pyenvCan be used to manage and switch between different pythonVersions, compared with virtualenv and Anacondo to create a virtual Python environment, pyenvEasier and lighter to use. Installation
$ git clone git://github.com/yyuu/pyenv.git ~/.pyenv

Back ~/.pyenv is the address you want to install on the hard drive

Configuration

If you are using thebash

$ echo ‘export PYENV_ROOT="$HOME/.pyenv"‘ >> ~/.bashrc$ echo ‘export PATH="$PYENV_ROOT/bin:$PATH"‘ >> ~/.bashrc$ echo ‘eval "$(pyenv init -)"‘ >> ~/.bashrc

If you are using thezsh

$ echo ‘export PYENV_ROOT="$HOME/.pyenv"‘ >> ~/.zshrc$ echo ‘export PATH="$PYENV_ROOT/bin:$PATH"‘ >> ~/.zshrc$ echo ‘eval "$(pyenv init -)"‘ >> ~/.zshrc

After that, reload the shell

$ exec $SHELL -l
Use

View the version you are using now python

$ pyenv version

View the versions available for use by Pyenv python

$ pyenv versions

Installation python version

$ pyenv install <python版本>

The installed version will be in the ~/.pyenv/versions directory.

For larger version files, such as Anaconda, can be downloaded first to the official website, and then put the file in the ~/.pyenv/cache directory, and then execute the installation command, PYENV will not repeat the download.

In addition, you can use --list the parameters to view the version that can be installed

$ pyenv install --list

Uninstall will be install changed to uninstall line

$ pyenv uninstall <python版本>

Setting python a global version is generally not recommended to change global settings

$ pyenv global <python版本>

Set Local python version

$ pyenv local <python版本>

After setting, you can try or see the effect separately in the table of contents which python python --version , if not change, you can try $ python rehash again later.

Updatepyenv

$ cd ~/.pyenv$ git pull

Python Learning pyenv Tutorial

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.