Reinstall python 2.7.12 and python 3.5.2
Asked Answered
U

1

7

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

Urology answered 4/2, 2017 at 19:1 Comment(6)
Which operating system are you using?Unrivalled
Then probably you shouldn't uninstall 2.7.12, since it may render your OS largely unusable (from experience). You can use the anaconda / miniconda python distribution for Python 3.5, since it will include most of what you need. I don't think it's necessary to uninstall what's already there, anaconda is non-intrusive. conda.io/docs/install/quick.html and specifically conda.io/miniconda.htmlUnrivalled
maybe put it in the question instead of a comment?Iridescence
It is probably something to do with your path variable. Make sure python is defined in your pathSphery
Sorry yedpodtrzitko, i forgot that and i put it in comments to answer to Jacques's question.Urology
when you try to install, what errors do you get? this info could be helpful to responders...Redheaded
R
15

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
Redheaded answered 4/2, 2017 at 19:20 Comment(4)
Thank you Alex, it works. I will add the path to bash.rc . The problem was pip, i forgot to specify the python version, and then i followed 3 or 4 solutions i found in other forums and i messed up everything. I will also check the Anaconda alternative, as Jacques de Hooge suggested.Urology
Excellent, glad it worked! Yes, anaconda is a good choice too if you're doing stuff on your own and don't need to integrate with anyone else or their install/deploy reality.Redheaded
Well that's a good recommendation, but having done a similar thing to the OP and messed up my OS a bit I would like to fix it. I reinstalled things like gnome-desktop which had been removed, and now my OS is pretty much fine, but a few things are still broken due to being unable to load libpython3.5m.so. I have tried reinstalling various packages like libpython3.5 and libpython3.5-dev, but these just seem to create yet more symlinks, without replacing the missing library. So it would be nice to know which packages contain the "real" python libraries that are missing.Curmudgeon
apt-get remove python3 will remove half of the system with it automatically.Anabolite

© 2022 - 2024 — McMap. All rights reserved.