I have accidently installed Python packages to my system using pip
instead of apt-get
. I did this in two ways:
- using an older version of virtualenv, I forgot to append
--no-site-packages
when creating the virtualenv - after that when I calledpip install
, the Python packages where installed to the system rather than the virtualenv - in a correctly setup virtualenv, I typed
sudo pip install somepackage
- the sudo installed to the system rather than the virtualenv
I happened to notice this because I typed pip freeze
outside a virtualenv, and spotted some Python packages listed that shouldn't be there. So now my question is:
- how do I identify all Python packages that have been erroneously installed on the system (that is, Python packages that appear in the
pip freeze
list, but were not installed withapt-get
)? - how do I remove them?
sudo rm -r /usr/local/lib/python2.7
. So far so good. – Apteryx Sep 22 '16 at 00:49/usr/local/lib/python3.5
, and after a while an upgrade ofupdate-notifier-common
package failed because of missing Python 3six
package. I ended up installingsix
withsudo -H pip3 install six
. – Alexey Apr 08 '17 at 08:54/usr/local/bin/
(a while ago i just removed/usr/local/lib/python3.5
and switched to conda). – Alexey Feb 28 '18 at 12:29