Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reinstall python 2.7.12 and python 3.5.2

Good evening,

today i messed up my laptop trying to install some packages for python 3.5.2. I tried to install the correct pip version but i missed something and now i can't install any package in both versions and i can't solve the problem. Is it possible to unistall the 2 versions (including all packages) and reinstall everything? I don't use Python 2.7.12 (but i'l like to have a clean version of it), i need python 3.5.2 with the correct pip version to install, for example, the packages NumPy, SciPy, matplotlib etc.

Thanks in advance,

J

like image 428
Zero G Avatar asked Feb 04 '17 19:02

Zero G


People also ask

How do I install multiple versions of Python?

Install that version using "make install". Install all other versions using "make altinstall". For example, if you want to install Python 2.5, 2.6 and 3.0 with 2.6 being the primary version, you would execute "make install" in your 2.6 build directory and "make altinstall" in the others.

Can you have Python 2 and 3 at the same time?

We can have both Python 2 and Python 3 installed on any Windows or Linux device. We can either create different environments on different IDEs to use the versions separately or use the following ways to run them using the command prompt.


1 Answers

I'd highly recommend using virtualenv, and never modifying the system python, except to install pip and virtualenv if necessary.

As was alluded to above, many OSes count on having a working python2 in order to function.

So...

[UPDATE: this worked in 2017, and may not work well in later years!]

apt-get remove python3
apt-get install python3
pip3 install virtualenv
virtualenv -p python3 venv
. venv/bin/activate
# now you are in a nice python3 world, completely isolated from system python
# remember to say . venv/bin/python every time you do anything
# or you can even add it to your .bashrc
like image 50
Alex L Avatar answered Sep 27 '22 20:09

Alex L