I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6.
For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
The accepted answer is outdated. So first,
pip
is preferred overeasy_install
, (Why use pip over easy_install?). Then follow these steps to installpip
on Windows, it's quite easy.Install
setuptools
:Install
pip
:Optionally, you can add the path to your environment so that you can use
pip
anywhere. It's somewhere likeC:\Python33\Scripts
.I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
python setup.py install
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
As I wrote elsewhere
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
You don't need the executable for setuptools. You can download the source code, unpack it, traverse to the downloaded directory and run
python setup.py install
in the command promptOr just put the directory to your pip executable in your system path.
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
You can type directly into the search menu
pip install mechanize
, select command and it will install:If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.