2

I tried to downgrade my python version from 3.0 to 2.7.13 by following this instruction

Finally, I ended up with Python 2.7.13 (default, Mar 6 2018, 01:35:39), I realized that this version could not compatible with my currently project, that some modules which was used to working are depreciated

ExtDeprecationWarning: Importing flask.ext.sqlalchemy is deprecated, use flask_sqlalchemy instead. from flask.ext.sqlalchemy import SQLAlchemy

The version that could be working is Python 2.7.13 (default, Nov 7 2017, 00:42:48) as checking on other machine working on the same project.

I don't want to change some modules to compatible with python version, instead I want to downgrade my python version to the previous working one Python 2.7.13 (default, Nov 7 2017, 00:42:48).

Any clues how can I downgrade it to the working python version? I'm Ubuntu 17.10. Thanks.

Houy Narun
  • 1,557
  • 5
  • 37
  • 86
  • I use [`pyenv`](https://github.com/pyenv/pyenv) when I need a specific version installed. – Robᵩ Mar 05 '18 at 19:29
  • *Why* do you need that specific version of Python? You should *almost never* need *that* specific a version of any language. If your question is just about how to install 2.x alongside 3.x then there's plenty of material about how to do that elsewhere. If you really do need that specific version (it does happen sometimes) it would help us help you to know why. – Jared Smith Mar 05 '18 at 19:52
  • @JaredSmith I had thought about that and I found one solution as stated in link referenced in question, and almost version that I need 2.7.13 but I noticed that version date and time stamp was much different. That would be great should there is a material I could follow along to get thing done as specified, thanks a lot . – Houy Narun Mar 05 '18 at 20:00
  • That question is about how to install a more recent version of python2 than what's available in the ubuntu repos, not how to install python2 at all. Just `sudo apt install python2.7`. You will also likely want to install `python-pip` and reinstall your dependencies. **NOTE** you will need to call them specifically: pip2 install blah and python2 somefile.py. Just typing an unqualified `python` will get you python3. – Jared Smith Mar 05 '18 at 20:11

1 Answers1

2

First: leave the system Python to the system. Ubuntu uses Python as part of the operating system, and if you mess around with it you run the risk of damaging essential components.

Second, although Ubuntu comes nowadays with Python 3, you can still install Python 2 with it, and have them happily co-exist. You might want to learn about the $PATH shell environment variable, which you can set to have python mean something different in your shells than it does in the system shells.

You don't say where your Python 2.7 installations come from, but there should be little essential difference between two difference 2.7.13 builds. It may be that you installed libraries in one but not the other, but since you don't say how the compatibility problems you mention manifest themselves, or show any code, this is about as helpful as I can be.

holdenweb
  • 33,305
  • 7
  • 57
  • 77
  • Thanks for accepting the answer. If you are going to be using Python a lot you will also benefit from learning about virtual environments, but if a casual user, perhaps not. – holdenweb Mar 05 '18 at 19:53