Vladimir Zolotykh
Vladimir Zolotykh

Reputation: 529

How see if Python interpreter using virtual environment?

Please confirm or refute: I have created python [3] virtual environment and installed some packages [for elpy]

$ virtualenv --python=/usr/bin/python3.4 pyvenv3/
$ source pyvenv3/bin/activate
$ easy_install rope
$ easy_install autopep8
$ easy_install yapf
$ easy_install jedi
$ easy_install flake8
$ easy_install importmagic [?]

The terminal prompt has changes to :

(pyvenv3)visteon@debian:~/Documents/bitbucket-python-scripts$ 

Does this mean that if I run Pyton3 from within this terminal window it will be running in the virtual environment pyvenv3 ? Is there a way to see (or confirm) that the started Python interpreter is using the virtual environment?

Using: Debian Jessie, Python 3.4

Upvotes: 0

Views: 484

Answers (1)

Daniel Rodríguez
Daniel Rodríguez

Reputation: 685

Yes, your normal prompt should be something like: user@machine:, but after you enter in the virtual environment, it changes to (env_name) user@machine.

If you still thinks your prompt is lying to you, you can do pip freeze and it will show you the packages installed through pip. Normally, if your virtualenv is new, you won't have any package.

Other way: if you have in your machine the command python as alias for python2.7 or a different python version of your virtualenv, just type python in the virtualenv and see the version.

EDIT: I forgot to answer your 2nd question. Yes, if you are inside a virtualenv, your python command would use you virtualenv python version (and packages installed in the virtualenv)

Upvotes: 1

Related Questions