Python multi-version and various package management

Source: Internet
Author: User
Tags virtualenv

Python multi-version and various package management Python packages manage versions of Python version management

Because Python has 2.x and 3.x two large versions, and each project to build a variety of packages used in different versions (such as flask1.x), which makes a number of engineering development on the same host to complete the trouble (the project is not done by one person to complete, different people's configuration version is not the same, for all developers to successfully develop, It is necessary to make the development environment consistent, while one person may participate in several engineering developments.
Pyenv manages versions of Python.
Virtualenv manages the version of the package in the Python project (or the execution environment of the Python project).
But now pyenv-virtualenv integrates the VIRTUALENV function, in general, the use of pyenv can be.
Anaconda and virtualenv are almost the same, but they are more focused on scientific computing, so many scientific computing packages can be managed by Anaconda.

Preparation conditions for the management readiness installation of Python versions and packages
  1. sudo apt-get install-y make build-essential libssl-dev zlib1g-dev libbz2-dev \
  2. Libreadline-dev libsqlite3-dev wget Curl LLVM Libncurses5-dev libncursesw5-dev \
  3. Xz-utils Tk-dev
PYENV Installation

Manage third-party libraries with Anaconda using the PYENV Management system version.

    • (1) Select Install to $home/.pyenv directory (but you can install the other one somewhere).
      git clone https://github.com/yyuu/pyenv.git ~/.pyenv
    • (2) Configuring environment variables
      echo ' Export pyenv_root= ' $HOME/.pyenv ' >> ~/.BASHRC
      echo ' Export path= ' $PYENV _root/bin: $PATH "' >> ~/.BASHRC
    • (3) Add pyenv Initialize to your shell
      Echo ' eval ' $ (pyenv init-) "' >> ~/.BASHRC
      SOURCE ~/.BASHRC
Pyenv using commands
    • Showing a version of Python, Anaconda-2 supports python2.6 and 2.7 anaconda-3 support python3.3 and 3.4
  1. [Email protected]:~$ pyenv Install--list
  2. Available Versions:
  3. 2.1.3
  4. 2.2.3
  5. 2.3.7
  6. 2.4
  7. 2.4.1
  8. 2.4.2
  9. 2.4.3
  10. 2.4.4
  11. 2.4.5
    • Install and uninstall a version of Python
  1. Pyenv install-v 2.7.5
  2. Pyenv Uninstall 2.7.5
  3. RM-RF ~/.pyenv/versions/2.7.5 # #移除版本2.7.5
    • View and switch versions
  1. Pyenv versions
  2. Pyenv Local 2.7.5 # #局部文件下版本切换
  3. Pyenv Global 3.3.5 # #全局系统下的版本切换
Anaconda use of scientific computing packages:
    • Installation of Anaconda Scientific Computing package via pyenv
    1. Pyenv Install Anaconda

Python multi-version and various package management

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.