Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I find out which python virtual environment I am using?

Tags:

I have several virtual environment in my computer and sometimes I am in doubt about which python virtual environment I am using. Is there an easy way to find out which virtual environment I am connected to?

like image 870
Kay Avatar asked Dec 28 '18 00:12

Kay


People also ask

What version is my virtual environment Python?

Once you activate your virtual environment, you should be able to list out packages using pip list and verify version using python --version . Show activity on this post. This will give you a requirements. txt file inside your current directory, for ALL the packages and libraries that are installed for that virtualenv.

How do I know if I have Python environment?

To see a list of the Python virtual environments that you have created, you can use the 'conda env list' command. This command will give you the names as well as the filesystem paths for the location of your virtual environments.

How do I know if virtualenv is installed?

Verify if Virtualenv is installed There is a chance that virtualenv is already installed on your system. If you see a version number (in my case 1.6. 1), it's already installed.


Video Answer


1 Answers

You can use sys.prefix to determine which virtualenv you're in.

import sys print(sys.prefix) 

from the sys docs

A string giving the site-specific directory prefix where the platform independent Python files are installed

like image 131
wpercy Avatar answered Oct 24 '22 15:10

wpercy