Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: How do you check what is in virtualenv?

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?

like image 491
Merlin Avatar asked Nov 23 '17 19:11

Merlin


People also ask

How do I check my virtual environment in Python?

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 .

How do I see what packages are installed in virtualenv?

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.

How do I know my python environment?

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.


1 Answers

Once you activate your virtual environment, you should be able to list out packages using pip list and verify version using python --version.

like image 168
Mihir Dass Avatar answered Oct 17 '22 22:10

Mihir Dass