Creating a python project directly inside a folder could result in a catastrophic events. You might end up having libraries issues, environment issues or even python version and permission issues. To avoid all this we use virtual environment. For this we have a python library known as virtualenv which does the magic.
You don’t need to type too many commands for this. Just follow the instructions below and you will become a virtualenv magician.
First you need to install virtualenv. Execture the command given below and you will have virtualenv installed on your system
python -m pip install --user virtualenv
Create Virtual Environment
Now you have installed the virtual environment its time to create your project folder.
Execute the command below to create your virtualenv project folder.
python -m virtualenv paymentApiBackend
When you execute this command you will have a folder named
paymetnApiBackend now go inside the folder and you see some folders and files.
-paymentApiBackend --lib --Scripts --pyvenv.cfg
You will have work on root of this folder. Create a folder name
src. Now you will have this folder structure:
-paymentApiBackend --lib --Scripts --src --pyvenv.cfg
Place all your source code files and folders inside the
Start Virtual Environment
To start this virtual environment type the following line in terminal window of vscode or start a separate terminal for this:
This will start your virtual environment and now you can easily install any library specifically for this project.
All your installed libraries will be stored in folder