1. Remove the Python environment
There is no command to remove a virtualenv so you need to do that by hand, you will need to deactivate
if you have it on and remove the folder:
deactivate
rm -rf <env path>
2. Create an env. with another Python version
When you create an environment the python uses the current version by default, so if you want another one you will need to specify at the moment you are creating it. To make and env. with Python 3.X called MyEnv
just type:
python3.X -m venv MyEnv
Now to make with Python 2.X use virtualenv
instead of venv
:
python2.X -m virtualenv MyEnv
3. List all Python versions on my machine
If any of the previous lines of code didn't worked you probably don't have the specific version installed. First list all your versions with:
ls -ls /usr/bin/python*
If you didn't find it, install Python 3.X using apt-get
:
sudo apt-get install python3.X
rmvirtualenv
comes with virtualenvwrapper. You need that installed to make it work.$ virtualenv --clear path_to_my_venv
. I use this from time to time to make sure I don't have anything manually installed, like an old dependency no longer inrequirements.txt
.sudo
should not be necessary under normal circumstances. The whole point of a virtual environment is that you can manipulate it using your regular user account.