1. Why use a Python virtual environment

In practice, the Python version we work with and the related web framework version are often different, such as Python 2 + Django1.8, or Python 3.6 + Django1.12, both are easy to handle. Why don’t I just install two versions of Python on my computer?

But what if you have five, six, seventy-eight projects that require five, six, seventy-eight Python environments? This is where virtual environments come in.

2.1 Windows

Directly download the installation package, after downloading, directly the next default installation is good.

The 2.2 Linux or Mac

Directly download the script xxx.sh, XXXX refers to the version number, open the console terminal, CD to the download directory, and then directly install sh xxx.sh and it is OK. So if you want to learn Python, it is necessary to listen to the teacher’s class and get Python benefits. If you want to learn Python, you can go to the teacher’s Weixin: the first group is Mengy, the second group is 7762. Put the above two groups of letters together in order, and she will arrange the learning.

How to Play – Basic Command

3.1 Description of basic commands

Windows is best used with Conemu.

Relevant documents are available here:

Tool 8 groups of programmers stove time 】 【 links: https://pan.baidu.com/s/1i5HtBFn password: kw4f

Schematic diagram of new virtual environment:

3.2 Write a Django environment to test it:

Open your browser and you’ll see a working interface at 127.0.0.1:8000.

4. Customize command aliases [this is key]

Are some of the commands above not working? Don’t worry, because I’ve customized some.

Below is my own made up, you can customize. And you can put it in.bashrc, or.bash_profile!

The 4.1 Linux or MAC

Note: For Linux, it’s best to add your own environment variables. Conda will remind you when the script is finished.

Add the following line to.bashrc,

export PATH=/root/anaconda3/bin:$PATH

Finally, don’t forget to reload.

source ~/.bashrc

4.2 Windows is best used with Conemu

In the Settings – > Startup > Environment

alias cl=conda env list

alias cc=conda create -n $*

alias coa=activate $*

alias cod=deactivate

alias cr=conda remove –all -n $*

An example of the use of “supplement” on a Mac

Build py3-dj, use and delete the whole process