I'm using Ubuntu 16.04, which comes with Python 2.7 and Python 3.5. I've installed Python 3.6 on it and symlink python3 to python3.6 through alias python3=python3.6
.
Then, I've installed virtualenv
using sudo -H pip3 install virtualenv
. When I checked, the virtualenv got installed in "/usr/local/lib/python3.5/dist-packages"
location, so when I'm trying to create virtualenv using python3 -m venv ./venv1
it's throwing me errors:
Error Command: ['/home/wgetdj/WorkPlace/Programming/Python/myvenv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
What should I do?
We usually use
$ python3 -m venv myvenv
to create a new virtualenv (Heremyvenv
is the name of our virtualenv).Similar to my case, if you have both
python3.5
as well aspython3.6
on your system, then you might get some errors.NOTE: On some versions of Debian/Ubuntu you may receive the following error:
In this case, follow the instructions above and install the python3-venv package:
NOTE: On some versions of Debian/Ubuntu initiating the virtual environment like this currently gives the following error:
To get around this, use the virtualenv command instead.
NOTE: If you get an error like
then instead run:
First make sure you have python3.6 installed, otherwise you can install it with command:
Now install venv i.e
You can install python3.7/3.8 and also respective venv with above comman, just replace 3.6 with 3.X
Installing
python3.6
andpython3.6-venv
viappa:deadsnakes/ppa
instead ofppa:jonathonf/python-3.6
worked for meI think that a problem could be related to the wrong locale. I added to the
/etc/environment
the following lines to fix it:You need to source the file from you bash with this command: