简体   繁体   中英

How to tell if virtualenv is activated in Windows Git Bash

I created a virtual environment in my new directory with virtualenv env and then in Windows Git Bash ran env/Scripts/activate , which seemed to work. I didn't notice my virtualenv being displayed in parens at the beginning of the line (question1: can I set it up to work like that?), so to check if it was indeed activated I ran pip -V which gave me: pip 9.0.1 from c:\\tools\\python2\\lib\\site-packages (python 2.7)

Shouldn't that be giving the directory of my virtualenv rather than site-packages? I also ran pip list and it gave me a list of installs that I had (naughtily) installed globally for a different project. So I can only assume my virtualenv did not activate and I don't know why that is.

Your suspicions are correct. Try source Scripts/activate . What you did will run the command in a new and temporary shell instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM