I have successfully activated a virtual environment and installed packages there, but when I try to list those packages with pip list
I get the list of global packages, not those in the activated venv.
$ source ./venv/bin/activate
[venv] pip list
# ... global 2.7 packages are listed
[venv] pip3 list
# ... global 3 packages are listed
but
$ cd venv/lib/pythonXX/site-packages
$ ls
# ...venv's installed packages are listed
even though python -version
correctly lists the venv's Python (and not any global version).
How do I list my pip-installed packages inside a venv?
Installing virtualenv virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.
Pipenv. This command will list all packages installed, including any dependencies that are found in a Pipfile. lock file.
I resolved this problem by creating a new venv for my project and switch to it. Then, when I activate the venv and "pip list" into it, I list only venv packages. I think this problem happens when you rename project folder or venv folder or move those files maybe to reorganise your project structure.
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