pip -V is the option
When not in the virual environment, it gives the path in the system
(base) REKUMARM-M-WB8Y:server userrm$ pip -V
pip 20.2.4 from /opt/anaconda3/lib/python3.8/site-packages/pip (python 3.8)
now if we are inside the virual env, it gives the pip from the path of virtual env
for e.g. like this below
(base) REKUMARM-M-WB8Y:server userrm$ source venv/bin/activate
(venv) (base) REKUMARM-M-WB8Y:server userrm $ pip -V
pip 20.1.1 from /Users/userrm/Documents/CR/projects/POCs/BW2/server/venv/lib/python3.8/site-packages/pip (python 3.8)
references:
https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv#comment35880305_1883251
No comments:
Post a Comment