But why do you usually install `virtualenv` first, and then install `virtualenv` packages in it?

We know that on a server, we can install python, django, etc., and then run our django project. But why do you usually install virtualenv :

first?
yum --enablerepo=epel -y install python-virtualenv

then install these software packages in virtualenv ? Instead of installing these packages directly on the machine.

Feb.28,2021

because the system comes with python2 you are generally not allowed to touch it. The built-in python2 is a very important dependency of the system, so maybe in order to isolate your python3 from the system's python to prevent strange things from happening, you need a virtualenv bar

.

after looking at the answers of the other two brothers, I feel that their answers are the main reason. Of course, I have also encountered python that blew up the system

.

environments are isolated, and the environments of different projects do not interact with each other


this is obviously not "ordinary", but the things you encounter are handled in this way.
if you deploy only one project on a machine, you don't need to do this at all. (even for different versions of Python, you can compile one yourself and put it anywhere.)
if you want to deploy multiple projects, docker is also a better way to handle it.


you now have two projects, one using Django1.8, and the other using Django2.0
you want to run both projects now, but you only have one environment.


Virtual environment, keep the main environment clean and tidy

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31be6-2b607.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31be6-2b607.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?