Python Virtual Environment (VIRTUALENV)

Source: Internet
Author: User
Tags install django virtual environment virtualenv

Install Python3 Virtual Environment (VIRTUALENV) on Mac

Objective

Before we get to the installation steps, let's talk about a few questions:
1. Why should I install a virtual machine?
A separate virtual environment allows each Python project to use an environment alone without affecting the Python system environment or the environment of other projects. As follows

The overall point is to be concise, do not introduce some unnecessary library

Second: Installation virtualenv environment

1: Installation

# or [sudo] pip3 install virtualenv [sudo]# available

2: Detection version

Virtualenv--version

Three: Using

1: Create a folder to hold the project and related virtual environment files.

such as creating files, Weblogindjango folders

2: In the terminal CD to the Weblogindjango folder path

3: Create a virtual environment

Virtualenv Weblogindjango  or
Virtualenv Weblogindjango--python=python3.6 #选择不同版本的python  or

Virtualenv--no-site-packages Weblogindjango--python=python3.6 #指定只需要一个干净的环境, not the original with the various third-party libraries

Created successfully.

Activating a virtual environment

Source/users/chenhuili/desktop/javastuend/weblogindjango/weblogindjango/bin/activate

Note that you need to go to the folder operation related script file, /users/chenhuili/desktop/javastuend/weblogindjango/weblogindjango/bin/

Activation instruction: Activate

After successful activation, in the virtual environment, all the command line before the operation has the name of the folder, for example, the activation is successful

4: Install the relevant library

such as installing the Django Library

PIP3 Install Django

5: Exiting the virtual environment

Deactivate

Python Virtual Environment (VIRTUALENV)

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.