how can I find the path of virtualenv python

2019-08-14 02:36发布

问题:

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

回答1:

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 python3
/home/attie/projects/thing/venv/bin/python3
/usr/bin/python3


回答2:

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