0

I'm having an issue were I need to install ansible and PIP but when I go to install the packages, Ubuntu automatically will try and update python to version 3.8. I need to keep version 3.6, and I need all supporting packages to be python 3.6

Take the example below. I want to install pip, but Ubuntu wants to serve me python 3.8. Is there a way to set the version of python I want?

 python3 --version
Python 3.6.15

sudo apt-get install pip:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'python3-pip' instead of 'pip'
The following packages were automatically installed and are no longer required:
  distro-info-data ieee-data libyaml-0-2
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3 python3-dev python3-distutils python3-lib2to3 python3-pkg-resources python3-setuptools python3-wheel python3.8 python3.8-dev zlib1g-dev
Suggested packages:
  python3-doc python3-tk python3-venv python-setuptools-doc python3.8-venv python3.8-doc
The following NEW packages will be installed:
  libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3 python3-dev python3-distutils python3-lib2to3 python3-pip python3-pkg-resources python3-setuptools python3-wheel python3.8 python3.8-dev
  zlib1g-dev
0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/7912 kB of archives.
After this operation, 30.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
Nmath
  • 12,333
  • 3
    You should use an environment for this. If you deviate from the system python version in repositories, it's likely that something will break. – Nmath Mar 27 '22 at 01:00
  • 1
    *DO NOT MESS WITH PYTHON VERSIONS MANUALLY* - Using the default is fine, and updating it with sudo apt upgrade is fine. But, if you attempt to change the default version yourself, or worse, delete Python all up, *you will cause serious problems for your system*. Please use either Python virtual environments or Docker instead of messing with the default system versions. Also, if your app only runs on older versions of Python, sooner or later it will break. – cocomac Mar 27 '22 at 05:45

0 Answers0