0

I am using Python 2.7 and I've just created a virtual environment using the command virtualenv testingdir and inside the directory contains 4 subdirectories: bin, include, lib, and local.

I cd testingdir and execute bin/pip install flask-wtf , however when I execute pip freeze I get a long list of all the dependencies and even when I exit out of the testingdir directory I still get the same output when I use pip freeze. Can someone explain how to get only the dependencies for my virtual environment only?

Jaquacky
  • 561
  • 2
  • 6
  • 16
  • Are you including your globally-installed packages in your virtual environment? – jonrsharpe Jun 30 '15 at 14:51
  • 1
    Have you activated your virtual environment? – kaveh Jun 30 '15 at 14:51
  • Yes I think I may be including globally-installed packages, however I am new to flask so I'm not sure on which commands to execute to avoid including everything. EDIT: Thank you kaveh it seems that I had not activated my virtualenv – Jaquacky Jun 30 '15 at 14:55

1 Answers1

1

After running bin/pip install flask-wtf run bin/pip freeze.

The comfortable way of using virtualenvs is:

virtualenv --no-site-packages testingdir  # not using system wide site packages
. testingdir/bin/activate # activate it
# do some stuff
pip install flask-wtf
pip freeze
deactivate # deactivate it

When the virtual environment is activated, command like python or pip run the executables in testingdir/bin.

Note that after running pip install some_package inside a brand new virtual environment you should not expect pip freeze to print only some_package; it will print all dependencies of some_package as well.

Bartosz Marcinkowski
  • 6,651
  • 4
  • 39
  • 69