Skip to main content

How to create a Python virtual environment in Ubuntu?

Run the following commands:

sudo apt update
sudo apt install python3
python3 -V
sudo apt install python3-pip
pip3 -V
pip3 install virtualenv
virtualenv env
source env/bin/activate
(env) > python -V
Python 3.10.1
(env) > pip -V
pip 21.3.1 from /home/user/env/lib/python3.10/site-packages/pip (python 3.10)
(env) > deactivate

Other way of creating virtual environment:

python3.10 -V
Python 3.10.1
> python3.10 -m venv venv1
> source venv1/bin/activate
(venv1) > python -V
Python 3.10.1
(venv1) >pip -V
pip 21.2.4 from /home/user/venv-1/lib/python3.10/site-packages/pip (python 3.10)
(venv1) > deactivate
>

python -V
Python 3.8.10
python -m venv venv2
source venv2/bin/activate
(venv2) > python -V
Python 3.8.10
(venv2) > pip -V
pip 20.0.2 from /home/user/venv-2/lib/python3.8/site-packages/pip (python 3.8)
(venv2) > deactivate
>

Comments

Popular posts from this blog

AWS Route53 - Private Hosted Zone

AWS - Error - An error occurred (ExpiredToken) when calling the DescribeStacks operation: The security token included in the request is expired

Error:   An error occurred (ExpiredToken) when calling the DescribeStacks operation: The security token included in the request is expired. Reason: It occurred when I ran a MAKE command with a profile having expired token (security credentials) Fix: Generate new security credentials (aws sts assume-role) and run the command again

AWS CloudTrail

AWS CloudTrail is an API monitoring service.  It records activities in your account. We can log those activities in S3 bucket It gives visibility to user activities e.g., if you want to know who created an EC2 instance, you can get the answer using CloudTrail Using CloudTrail, you can track changes to AWS resources in your accounts