Python Multi-environment management

Source: Internet
Author: User

Python environment Management What is anaconda

Anaconda is a Python release that focuses on data analysis and contains more than 190 science packages, including Conda, Python, and their dependencies. Anaconda simplifies your workflow with the Management Toolkit, development environment, and Python version. It is not only easy to install, update, uninstall the toolkit, but also to install the appropriate dependencies automatically, while you can use different virtual environments to isolate the different requirements of the project.

What is Conda

Conda is an open-source package, a virtual Environment manager that can be used to install different versions of packages and dependencies on the same machine, and to switch between different environments, with package management similar to PIP.
Packages Management: You can use Conda to install, update, uninstall toolkits, and it is more focused on data science-related toolkits. Packages such as Numpy, Scipy, Pandas, Scikit-learn, which are commonly used in data analysis, are pre-integrated when Anaconda is installed. Also worth mentioning is that Conda not only manages Python's toolkit, it can also install non-Python packages. For example, in the new version of Anaconda can be installed in the R Language integrated development environment Rstudio.

Virtual Environment Management: In Conda, you can establish multiple virtual environments to isolate different versions of the toolkit required by different projects to prevent conflicts on the version. For those of you who are entangled in the Python version, we can also build Python2 and Python3 environments to run different versions of Python code separately.

Installation and use

The installation process is a little, very simple, after installation run the following command to add the source, so that later through the Conda installation package will go home mirror. The mirror is not just anaconda.

--add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config--add Channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/--set show_channel_ URLs Yes

Anaconda installed framework will be placed under directory ~/anacondax/envs for different Python environments installed by the user
Environment variables are automatically added to the ~/.bash_profile/users/steven/anaconda
You can run Conda info-e in the command to see the installed environment, for example, I have multiple environments here.

Common commands
# Confirm that Conda is installed Conda--version# Updates anacondaconda update anaconda# update conda version conda update conda# updates all packages in the current environment Conda update--all# updated Pythonconda Update python # Find package plus--full--The name command to list the matching packages Conda Search package name Conda Search*scikit*# Fuzzy Query # Create a new environment, which is an environment of different software versions and their dependencies, which are isolated Conda create--Name the package name in the Environment name # View Current Environment CondaInfo--envs# View currently has several environments CondaEnvlist# Create an environment named PYTHON34 that specifies that the Python version is 3.4(No tube is 3.)4The. X,conda will automatically find 3 for us.4the latest version in. x) Conda Create--name Python34 python=3.4# when installed, use activate to activate an environment activate PYTHON34 # forWindowssource Activate Python34 # forLinux &mac# If you want to return to the default Python2. 7 environment, running deactivate PYTHON34 # forWindowssource Deactivate Python34 # forLinux &mac# return default environment source Deactivate # forLinux &Macdeactivate # forWindows # Delete an existing environment--all represents all packages in the environment Conda remove--name Python34--all# Delete A package in the specified environment Conda remove--name PYTHON34 Package Name

Package Management

Install 3.4-N python34 # Find package Information Conda Search NumPy # Installs the assembly to the specified environment, if not specified  -Install ---N python34 numpy

Description: for packages that cannot be installed through Conda or obtained from anaconda.org, we can usually use PIP to install the package.

Pip is just a package manager, so it can't manage the environment for you. PIP cannot even upgrade Python because it does not treat Python as a package like Conda. But it can install some Conda packages, both PIP and Conda are integrated in Anaconda or Miniconda.

Python Multi-environment management

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.