how to tell pip to uninstall python modules from previous python version?

I upgraded from Ubuntu 20.10 to 21.04 & the python version changed from 3.8 to 3.9. In 20.10 I installed many python modules using pip & they are at /usr/local/lib/python3.8/dist-packages/ & they are occupying a lot of space so I tried sudo pip uninstall name but pip says no such module installed even if it is there at /usr/local/lib/python3.8/dist-packages/ I think it searches it only in /usr/local/lib/python3.9/dist-packages/ which were installed in 21.04 so how do I tell pip to remove python modules from python version 3.8?

2

1 Answer

Every Python has own pip and check if you can do

pip3.8 uninstall ...

You can also try

python3.8 -m pip uninstall ...

If you don't have pip3.8 and there is no python3.8 then system doesn't use this version and you can simply delete folder

sudo rm -R /usr/local/lib/python3.8

Using pip -V you can see for what version it works. The same python -V show python version.

If you have many versions installed (ie. 2.7, 3.8, 3.9) then you should have programs python2,python2.7, python3, python3.8, python3.9 and pip2, pip2.7, pip3, pip3.8, pip3.9

9

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like