Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

If I download a module for Python (such as alglib) and installing is simply a matter of running

python install

Where should I be keeping the files I download, or the files that get created after I run Is there some neat folder in the python directory that people put these modules before running Can I move the files around after running it? Can I delete them... or will that stop them working?

I couldn't find any recommendation here:

Also I am running windows and installed python through python(x,y)

share|improve this question
Does C:\Python27\Lib\site-packages seems like the correct place? –  Dan May 9 '13 at 9:25

1 Answer 1

up vote 4 down vote accepted

Good question!

Python has this tool, called pip, which is python's package manager. It can pull packages from the PyPi repository (think an App Store).

These will handle where packages get installed for you. Almost every package I've found available on the Internet was also available on PyPi.

Along with this, there is another tool that is used in conjunction with pip: virtualenv.

This is similar to ruby's rvm/bundler (I believe, someone please fact check this part).

It allows you to create a "local" set of dependencies for your application. The install directory for packages - while this virtualenv is activate - would be C:\path_to_virtualenv\lib\python\site-packages\ . Installing via python install should drop the package into this directory!

A sample workflow that I follow:

cd dev/my_new_app
virtualenv ../venvs/my_new_app
source ../venvs/my_new_app/bin/activate
pip install my_new_dependency
pip freeze > requirements.txt

pip freeze will generate a list of all of the packages that you installed (along with versions). > says "put everything on the left into the right", which is a file. Anyone else who wants to start working on your project simply does pip install -r requirements.txt to get all of your dependencies installed!

If for whatever reason that library you are trying to work with (or an equivilant) is not available in the PyPi repository, the default install directory should now be considered your "install directory" for the .

Here is an awesome answer by Colonel Panic on installing pip on Windows.

If you decide not to use virtualenv, pip on its own will install to the default python package directory, which is somewhere around C:\\site-packages\

share|improve this answer
Thanks Travis, unfortunately alglib is not on PyPi :( Please could you explain what you mean by "default install directory should now be considered your "install directory" for the"? I just dropped the folder in the site-packages. But for future packages, I'll get PIP! –  Dan May 9 '13 at 12:52
Wow! That's surprising. You happened to find the one package that wasn't part of PyPi :P I was trying to say that with virtualenv setup, your "install directory" would be C:\path_to_your_virtualenv\lib\python<x.y>\site-packages . should take this into account, and also install there. Sorry, my answer was a little unclear there. I'll update it. –  Travis May 9 '13 at 13:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.