Anacodna Conda and Virtualenv use tutorials to create a virtual environment

Source: Internet
Author: User
Tags virtual environment virtualenv continuum analytics

Conda Creating a virtual Environment 1. View Packages
    • conda listSee which packages are installed
    • conda env listSee what virtual environments are available
    • conda -VView the version of Conda
2. Create a virtual environment, named myflaskappnmeans that name; and install flaskPackage.

Note that the Conda create command requires so you give it the name of the a package to install in the new environment.

condacommand to create a virtual environment, you must specify one or more of the ones you need to install package .

conda create -n py2 python=2* anaconda
This will install the ANACONDA2 version.

Chestnut 1:
This command installs a myflaskapp package named virtual Environment flask .

create -n myflaskapp flask

Chestnut 2:
This is the clone that created the same Python environment as the original system, named nb .

create -n nb --clone root

Chestnut 3:
There's no need to specify a specific package.

create --name $ENVIRONMENT_NAME python

Other:

create -n py3 python=3*$ conda create -n py2 python=2*

This would create the environments, one with Python3 and the other with Python2. I typically set one of these as my default by adding source activate Py3 to my terminal startup. Typically I only use these ' named Python ' environments to run a Python REPL or does general Python tasks. I ' ll create another Conda environment named specifically for each real project I work on.

This creates an environment of two Python versions.

3. Switching the environment

The Linux command was not tested.

    • Linux:source activate myflaskapp
    • Windows:activate myflaskapp

      Picture description
4. Close the Environment
    • Linux:source deactivate
    • Windows:deactivate
5. Change the specified virtual environment installation package
install -n yourenvname [package]
6. Removing a virtual environment
    • To remove a package from an environment
      $ENVIRONMENT_NAME $PACKAGE_NAME
    • Remove a virtual environment
      --all

All of these virtual environments are under the C:\Anaconda3\envs folder.

Virtualenv Creating a Virtual Environment 1. Install Virtualenv
install virtualenv
2. Create a virtual environment
$ mkdir myproject$ cd myproject$ virtualenv venv

Create a myproject folder named, and then create a virtual environment here venv .

The virtualenv of adding options when creating virtualenv --no-site-packages will not read the system package, as follows:

virtualenv nowamagic_venv --no-site-packages

--distributeOption enables virtualenv to use the new release-based package management system rather than the Setuptools-acquired package. All you need to know now is that the--distribute option automatically installs PIP in the new virtual environment, so you don't need to install it manually. When you become a more experienced Python developer, you will understand the details.

--distribute nowamagic_venv
3. Activating the virtual environment
    • Linux: $ . venv/bin/activate orsource $ENV_BASE_DIR/$ENVIRONMENT_NAME/bin/activate
      No experiments, so temporarily write two methods, if you go to the venv Virtual Environment folder, you cansource bin/activate
    • Windows:$ venv\scripts\activate
4. Exit the Environment
deactivate
Resources
    • Using Continuum Analytics Conda as a replacement for virtualenv, Pyenv, and more!
    • Conda vs. Pip vs. virtualenv
    • Create virtual environments for Python with Conda
    • Conda-documention
    • Flask-virtualenv Introduction
    • Switching between Anaconda and Anaconda3
    • Managing the Python development environment with Conda
    • Build multiple Python independent development environments with VIRTUALENV
    • Python Scientific Computing Environment recommendation--anaconda



Wen/michael_ Xiang _ (Jane book author)
Original link: http://www.jianshu.com/p/ab93973286cc
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".

Anacodna Conda and Virtualenv use tutorials to create a virtual environment

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.