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

Zero G
  • 117
  • 1
  • 1
  • 10
  • Which operating system are you using? – Jacques de Hooge Feb 04 '17 at 19:06
  • 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. https://conda.io/docs/install/quick.html and specifically https://conda.io/miniconda.html – Jacques de Hooge Feb 04 '17 at 19:11
  • maybe put it in the question instead of a comment? – yedpodtrzitko Feb 04 '17 at 19:11
  • It is probably something to do with your path variable. Make sure python is defined in your path – Vagif Feb 04 '17 at 19:11
  • Sorry yedpodtrzitko, i forgot that and i put it in comments to answer to Jacques's question. – Zero G Feb 04 '17 at 19:17
  • when you try to install, what errors do you get? this info could be helpful to responders... – Alex L Feb 04 '17 at 19:24

1 Answers1

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
Alex L
  • 1,114
  • 8
  • 11
  • 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. – Zero G Feb 04 '17 at 19:30
  • 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. – Alex L Feb 05 '17 at 02:30
  • 1
    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. – Ben Farmer Dec 06 '18 at 13:24
  • 4
    `apt-get remove python3` will remove half of the system with it automatically. – Slava Fomin II Dec 24 '20 at 10:47