I am trying to activate a Python virtual environment on Windows and it seems like it took OK:
I installed a module I needed for my venv, but when I deactivate the venv, the module I just installed is still listed under pip list
. I would have thought that after deactivating the venv, the module would no longer be considered "installed" since the venv is no longer active.
I tried the sys.prefix test and it returns False
suggesting that I am not actually in my venv. I took a look at this link also.
Any ideas?
If module appears in pip list
even after you deactivated the env, simply means that module was installed in Base Python Environment.
It often happens when you work with env's quite frequently and sometimes you install something forgetting the env was not activated.
One way is you can always pip uninstall <module>
from you base or even any env.
This solution will help you remove all non native Python Libraries without reinstalling Python from your device.
pip freeze > uninstall.txt
for Windows.uninstall.txt
will be used for backup plus removal as wellfor /F %i in (uninstall.txt) do pip uninstall -y %i
pip freeze | xargs pip uninstall -y
You can always reinstall Python. hardly takes 2 mins :)