Before we get into the topic, let us understand what Virtualenv is? Virtualenv as the word describes is a virtual envirornment. This tool provides assistance to users by creating a separate environment to a project from other projects.
How to install Python 3 VirtualEnv on Ubuntu
We can install Python 3 VirtualEnv in just 7 steps, beginning from updating repositories to leaving the virtual world.
Step #1: Updating Repositories
sudo apt-get update
Step #2: Installing Pip 3 for Python 3
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
sudo apt install python3-pip
Step #3: Using the pip to install VirtualEnv
sudo pip3 install virtualenv
Step #4: Launching Python 3
Naming our virtual environment as env3.
virtualenv -p python3 env3
Step #5: Activating Python 3 Environment
You can do this by 2 ways:
- Checking the directory.
env3/bin/activate
2. Checking the version to see if all things are working fine.
python -- version
Step #6: Start coding
Code all your stuff and execute/test it.
Step #7: Leaving the virtual environment of Python
deactivate
Conclusion:
Thank you for reading our article on “Install Python 3 virtualenv on Ubuntu”. If you have any queries, please comment below. We would love to help you.