How do you check what package and version are installed inside virtualenv?
My thought was to create requirement.txt
file. But, is there another way to do this from CLI?
If you want to verify that you're using the right pip and the right virtual environment, type pip -V and check that the path it displays points to a subdirectory of your virtual environment. Note that when you want to upgrade pip in a virtual environment, it's best to use the command python -m pip install -U pip .
Calling pip command inside a virtualenv should list the packages visible/available in the isolated environment. Make sure to use a recent version of virtualenv that uses option --no-site-packages by default.
From a shell prompt, you can just do echo $VIRTUAL_ENV (or in Windows cmd.exe , echo %VIRTUAL_ENV% ). From within Python, sys. prefix provides the root of your Python installation (the virtual environment if active), and sys. executable tells you which Python executable is running your script.
Once you activate your virtual environment, you should be able to list out packages using pip list
and verify version using python --version
.
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