1

My default Python installation is from pip which is at 2.7.10. apt-get has already Python 2.7.13 installed. I don't want to keep both installations because it's confusing, and I would prefer to keep the apt-get one because I'm more familiar with it. Can pip use the Python installation from apt-get?
Trying to uninstall pip Python, I get:

pedro@gordo-002528460857:~$ pip uninstall python
Cannot uninstall 'Python'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

What's the best way to work this out?
If you have any better advice, I'm happy to take it because I don't work regularly with Python, so I don't know the best practices here.

EDIT:
This is how I see that the 2.7.10 is from pip and not from apt-get: enter image description here

EDIT 2*:
More info from the .bashrc:

export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

And also:

pedro@gordo-002528460857:~$ which pip
/home/pedro/.pyenv/shims/pip
10
  • Does pip list list both python installations? Try uninstalling with specific version like pip uninstall python==2.7.10
    – beginer
    Apr 8, 2019 at 1:43
  • That uninstall command didn't work (same error I get). Running pip list doesn't show any python version on the list. What does that mean? Apr 8, 2019 at 11:03
  • Sorry I drifted away earlier, you can't install python with pip :-p . So back to the initial question, how did you install the python version 2.7.10, was it built from source code?
    – beginer
    Apr 9, 2019 at 3:26
  • @beginer I can't remember lol... :) How can I figure that out? Apr 9, 2019 at 9:42
  • 1
    yes remove those lines. I'll right an answer so that you can upvote and select as correct answer :-p
    – beginer
    Apr 11, 2019 at 23:49

1 Answer 1

1

The installation info you get from pip show python is actually a python virtualenv created by you or someone else into the path ~/.pyenv/bin:$PATH and was added to bashrc so that it gets loaded by default at login. So the solution is to delete those lines from .bashrc and re-login, then you'll only see and be able to use the system python version. If you want to use that virtualenv then run the command source ~/.pyenv/bin/activate and then to exit: deactivate

At the moment that virtualenv was created, the system python version was 2.7.10, hence the version shown by pip. Later the system python was upgraded thats why you see a latest version with apt-get now. Upgrading the system python doesn't affect virtualenv, you need to rebuild it if required. There is a good discussion on this topic here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .