Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
55
rated 0 times [  55] [ 0]  / answers: 1 / hits: 63284  / 3 Years ago, wed, october 6, 2021, 3:02:03

Ubuntu 20.04 has Python 3.6 and Python 3.8 support. Command python3 -m venv my_venv creates virtual environment with python 3.8 and it works as expected.



However, trying python3.6 -m venv my_venv3.6 does not work. The response I get is /usr/bin/python3.6: No module named venv.



I tried using virtualenv --python=/usr/bin/python3.6 my_venv3.6, which results in:



RuntimeError: failed to query /usr/bin/python3.6 with code 1 err: ...


I also tried installing sudo apt install python3.6-venv which results in:



Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3.6-venv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3.6-venv' has no installation candidate


Note that running python3.6 starts interactive python prompt with Python 3.6.9. I can also run scripts this way, so it seems that Python 3.6 is indeed usable on my system.



How can I start Python 3.6 virtual environment on Ubuntu 20.04?


More From » python3

 Answers
5

Ubuntu 20.04 ships with default Python 3.8. So first you will need to install Python 3.6.



  1. Install python 3.6:


    sudo add-apt-repository ppa:deadsnakes/ppa
    sudo apt-get update
    sudo apt-get install python3.6


  2. If the virtualenv package is not installed, run:


    apt-get update
    apt-get install python3-virtualenv


  3. Create a virtual environment:


    virtualenv -p /usr/bin/python3.6 venv



[#3720] Wednesday, October 6, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ticeate

Total Points: 497
Total Questions: 128
Total Answers: 112

Location: Samoa
Member since Fri, Nov 27, 2020
4 Years ago
;