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?
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.
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.
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.
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
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