Imagine that one did not realize how virtual environments work in Python and installed a lot of packages using sudo pip install
for OS:X. Now they are facing problems managing package versions.
This would never happen if one understands virtual environments, but if one did this prior to being enlightened, how can that someone easily remove all my their non-virtual environment packages that were installed, without breaking any default installations?
Note this includes several programs (such as nosetests) and is not limited to exclusively libraries. It seems I can create a virtualenvironment with --no-site-packages
and that gets around at least the packages (assuming I wipe my PYTHONPATH). But my actual PATH seems to let me see the executables I installed, too.
Nothing in my base installation of OS:X is installed with pip. This means you can uninstall everything from pip on your OSX without "worrying" - in terms of actual system performance. It is possible this will interfere with your day-to-day activities, if you are relying on global pip packages.
You can verify what packages you have installed by viewing the full list:
pip freeze
Everything this returns are user installations. This means you can "safely" pass this as arguments to pip uninstall:
pip freeze | xargs sudo pip uninstall -y
which will uninstall all items installed with pip on your machine.
You may accidentally be using these in some of your virtual environments, particularly if your PYTHONPATH
variable is set to any of your local install directories. Any of pip's installed packages that are executables will also be visible inside of a virtual environment, assuming that you are not overwriting your PATH
variable as part of your virtual environment.
In my case, the only item I had to reinstall was the virutalenv wrapper:
pip install virtualenvwrapper
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With