"Python" Python Environment setup

Source: Internet
Author: User
Tags virtual environment

This article is mainly used to record the Python environment to build some of the less commonly used commands, other installation steps can be found in other masters are not listed in detail. (Note: The following actions are in the Ubuntu14.04lts version)

I. Environmental query-related

1. Query the package and version information installed in the current Python environment.

Pip Freeze

Two. Virtual environment-related

1. Using virtualenv to establish a virtual environment

[Email protected]:~$ export virtual_use_distribute=true[email protected]:mkdir ~/  Work[email protected]:~$ cd ~/work/[email protected]:env

2. Virtual Environment activation

env/bin/Activate (env

3. Exiting the virtual environment

(env) [Email protected]:~/work$ Deactivate [email protected]:~/work$

4. Powerful Virtualenvwrapper

(1) Installation Virtualenvwrapper

Install Virtualenvwrapper

(2) Modify. BASHRC

if  Then     export Workon_home= $HOME/. Virtualenvs    /usr/local/bin/virtualenvwrapper.  SHfi

(3) Update. BASHRC Environment

[Email protected]:~/work$ Source ~/.BASHRC

(4) Create a virtual environment

[Email protected]:~/work$ mkvirtualenv newenv (newenv) [email protected]:

(5) Exiting the virtual environment

(newenv) [Email protected]:~/work$ Deactivate [email protected]:

(6) Entering the virtual environment

[Email protected]:~/work$ Workon newenv (newenv) [email protected]:

(7) View the virtual environment inside the current environment

[Email protected]:~/work$ Workon newenv

(8) Deleting a virtual environment

[Email protected]:~/work$ rmvirtualenv newenvremoving newenv ... [Email protected]:~/work$ workon[email protected]:

5. Using different versions of Python (implemented through a virtual environment)

Python2. 7 [email protected]:~/work$ mkvirtualenv--python=/usr/bin/python2. 7 Newenv2python3. 4 [email protected]:~/work$ mkvirtualenv--python=/usr/bin/python3. 4 Newenv3

"Python" Python Environment setup

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.