venv

Posted under » Python » Django on 22 April 2021

Python applications will often use packages and modules that don’t come as part of the standard library. Applications will sometimes need a specific version of a library, because the application may require that a particular bug has been fixed or the application may be written using an obsolete version of the library’s interface.

This means it may not be possible for one Python installation to meet the requirements of every application. If application A needs version 1.0 of a particular module but application B needs version 2.0, then the requirements are in conflict and installing either version 1.0 or 2.0 will leave one application unable to run.

Before installing django, install venv first.

$ sudo apt install python3-venv

Make a new folder and

$ mkdir student // then go inside the directory
$ python3 -m venv studentals

You need to activate it. You can deactivate it too.

$ source studentals/bin/activate
(student_als) hanafi@anoneh:~/www/student$

You’ll now notice that the name of our virtual environment "student_als" is preceding our command prompt. This indicates we are now working within our activated virtual environment.

Now install Django or MySQLclient or whatever python libraries using pip.

To get out of the environment,

(student_als) $ deactivate
$

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS