Search code examples
pythonvirtualenvpython-3.5tensorflow1.15python-versioneer

how to downgrade python3.8.10 to 3.5.6 on ubuntu via the terminal?


In order to install older version of keras, tensorflow 1.10.0 is needed. That should solve compatibility issues with an algorithm I am trying to run. TO be able to install these older versions of tensorflow and keras and older version of python is required. I have tried to work with different algorithm using my linux system, terminal and have not been successful so far. I wish to know how to downgrade my current python version (replacing my version on the OS system or through a virtual environment) to python 3.5.6 or even 2.7. The code I am trying to run is FSA-Net at https://github.com/shamangary/FSA-Net I am trying to run the demo 'sh run_demo_FSANET.sh' after cloning to my local computer.

  • I do not use anaconda. I use pip.
  • I could not install Pyenv on my ubuntu.
  • I also donot have brew I have qbrew, which does not follow with the other commands suggested at How to downgrade python from 3.7 to 3.6.

Thank you in advance.


Solution

  • You can have multiple versions of Python at the same time.
    First, install your python ver (alongside your present version):

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

    Then create & setup your project:

    cd your_project
    # Create venv
    python3.5 -m venv venv
    # Source 
    source venv/bin/activate
    # Install everything you need
    pip install {package_name}
    

    That's it! You should be good to go.

    NOTE: you did not specify what version of Linux you have, so I assumed it's Ubuntu. But the process should be the same for the other versions of Linux also (just different commands).