This repository contains some examples of backend applications using:
There are two ways of creating a virtual environment in python.
- creating a virtual environment from a already exists folder.
- to create a virtual environment in the existing folder you first need to navigate to the folder that you wnt to create virtual environment by running the command:
cd myv
- then you run the following command to create a virtual environment
virtualenv .
This just means create a virtual environment in the current directory.
- creating a virtual environment and naming it.
- to create a virtual environment by name you run the following command:
virtualenv venv
To activate virtual environment you have to run the activate.bat
file that will be generated in virtual environment that you have created for example:
.\venv\Scripts\activate
# or
.\venv\Scripts\activate.bat
Activating the first virtual (myv) you will do it as follows:
.\Scripts\activate
# or
.\Scripts\activate.bat
To deactivate virtual environment you have to run the deactivate.bat
file that will be generated in virtual environment that you have created for example:
.\venv\Scripts\deactivate
# 1.
.\venv\Scripts\deactivate.bat
Activating the first virtual (myv) you will do it as follows:
.\Scripts\deactivate
# 1.
.\Scripts\deactivate.bat
I recommend to navigate to the project directory after creating a virtual environment before installing packages:
π root
π venv
To install the packages after activating the virtual environment you just run the following command:
pip install <package_name>
# example
pip install numpy
If you are getting a command error that says:
'virtualenv' is not recognized as an internal or external command,
operable program or batch file.
You could try to install virtualenv
using pip as follows:
pip install virtualenv
Or
python -m pip install virtualenv