Sure, here are the steps to create a Python 3 virtual environment with virtualenv
:
- First, ensure that you have
virtualenv
installed. You can install it via pip by running the following command:
pip install virtualenv
- Once
virtualenv
is installed, navigate to the directory where you want to create the virtual environment. - Create a new virtual environment by running the following command:
virtualenv -p python3 env_name
Here, env_name
is the name you want to give to your virtual environment. The -p
flag specifies the Python version you want to use, in this case, python3
.
- Activate the virtual environment by running the following command:
source env_name/bin/activate
This will activate the virtual environment and you should see its name in your terminal prompt.
- Now you can install packages and run Python scripts within this virtual environment, without affecting the global Python environment on your system.
- When you’re done using the virtual environment, you can deactivate it by running the following command:
deactivate
That’s it! You’ve successfully created a Python 3 virtual environment with virtualenv
.
+ There are no comments
Add yours