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
:
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
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 commandsource ~/.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 withapt-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