1

I have python 3.7.3 installed on Ubuntu. But I want to have a virtual environment with python 3.7.4 installed.

python3 -m venv: how to specify Python point release/version? says to create a venv with sepecific version itself, but I do not want to upgrade the system wide installation. I would not prefer to install python anywhere (even for specific user) other than the virtual environment itself. It is a new virtual environment.

Is it possible to install a newer python version in venv without installing it anywhere else?

I am open to any configuration changes (hacks) to achieve this.

  • Have you tried docker as possible alternative? This solve many problems of traditional system-wide installations, since you can run as many container as you want with different software versions in each. Find Python Images here? https://hub.docker.com/_/python – Lion Sep 08 '19 at 08:11
  • @Lion No, i have not tried docker. I do know about it, but it is just a simple environment to try out some scripts, not a full project. So I would prefer it to be simple. Since venv is supposed to be an isolated environment, where we can continue with older installations after upgrading system installation, it should be possible to do the opposite as well, i.e., upgrading venv environment without upgrading system wide installation. – user12036855 Sep 08 '19 at 08:19

1 Answers1

0

virtualenv is a tool to create isolated Python environments. For detail info see https://docs.python-guide.org/dev/virtualenvs/ .

It uses installed python on system to create isolated Python environments.

Is it possible to install a newer python version in venv without installing it anywhere else?

No, I don't think so. But if you wants to do so you must go with docker https://hub.docker.com/_/ubuntu . It will give you flexibility to install the specific python version in fresh ubuntu docker image.

Saleem Ali
  • 1,363
  • 11
  • 21