Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I find the path of virtualenv python

how can I find the path of virtualenv python ,built with this tutorial?
(i want to find python in this env and use it in my eclipse)

$ sudo pip install virtualenv virtualenvwrapper
$ export WORKON_HOME=$HOME/.virtualenvs
$ source /usr/local/bin/virtualenvwrapper.sh

$ echo -e "\n# virtualenv and virtualenvwrapper" >> ~/.bashrc
$ echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.bashrc
$ echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc

$ source ~/.bashrc

$ mkvirtualenv cv -p python3
like image 455
hossein hayati Avatar asked Aug 08 '18 15:08

hossein hayati


People also ask

How do I find the path of a Python virtual environment?

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 .

Where virtualenv is installed?

If you try to run virtualenv and find it isn't present, you can install it using pip. virtualenv.exe will likely now be found in your python installation directory under the Scripts subdirectory.


2 Answers

You can use which to find out which binary will be executed...

For example:

$ which python3
/home/attie/projects/thing/venv/bin/python3

By default it just shows the first match, but you can give the -a argument to show all:

$ which -a python3
/home/attie/projects/thing/venv/bin/python3
/usr/bin/python3
like image 175
Attie Avatar answered Sep 24 '22 10:09

Attie


mkvirtualenv creates virtualenvs in $WORKON_HOME, that is your virtualenv is in $HOME/.virtualenvs/cv/.

like image 36
phd Avatar answered Sep 25 '22 10:09

phd