How to use virtualenv with python3.6 on ubuntu 16.04?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to use virtualenv with python3.6 on ubuntu 16.04 in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to use virtualenv with python3.6 on ubuntu 16.04?

  1. How to use virtualenv with python3.6 on ubuntu 16.04?

    Installing python3.6 and python3.6-venv via ppa:deadsnakes/ppa instead of ppa:jonathonf/python-3.6 worked for me

  2. use virtualenv with python3.6 on ubuntu 16.04

    Installing python3.6 and python3.6-venv via ppa:deadsnakes/ppa instead of ppa:jonathonf/python-3.6 worked for me

Method 1

We usually use $ python3 -m venv myvenv to create a new virtualenv (Here myvenv is the name of our virtualenv).

Similar to my case, if you have both python3.5 as well as python3.6 on your system, then you might get some errors.

NOTE: On some versions of Debian/Ubuntu you may receive the following error:

 The virtual environment was not created successfully because ensure pip is not available.  On Debian/Ubuntu systems, you need to install the python3-venv package using the following command.
      apt-get installpython3-venv  
 You may need to use sudo with that command.  After installing the python3-venv package, recreate your virtual environment. 

In this case, follow the instructions above and install the python3-venv package:

$ sudo apt-get install python3-venv

NOTE: On some versions of Debian/Ubuntu initiating the virtual environment like this currently gives the following error:

Error Command: ['/home/wgetdj/WorkPlace/Programming/Python/myvenv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

To get around this, use the virtualenv command instead.

$ sudo apt-get install python-virtualenv
$ virtualenv --python=python3.6 myvenv

NOTE: If you get an error like

E: Unable to locate package python3-venv

then instead run:

sudo apt install python3.6-venv

Method 2

Installing python3.6 and python3.6-venv via ppa:deadsnakes/ppa instead of ppa:jonathonf/python-3.6 worked for me

apt-get update \
&& apt-get install -y software-properties-common curl \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update \
&& apt-get install -y python3.6 python3.6-venv


It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read