• How do you install python stuff?
    4 replies, posted
I have been using python and Learning Python the Hard Way for a while and I just came to the point where it tells you to install all of that custom stuff: Pip, distribute, etc. I have been looking all over, but cannot find any step by step guides to installing things in the Distutils form. I am terribly sorry if it's just me being stupid and missing any guides that there are. Please help me.
On Windows, your best bet is to find a Windows installer of that library for your version of Python. Google is your friend. Usually they come in msi files that automagically detect your Python installation and do whatever they need to do to get stuff working. On Linux, either look for that library in your distro's package manager (beware of 2.x vs 3.x packages). If that doesn't work, download the source of that module, cd into it and run [b]`python setup.py install`[/b]. You can automate this by installing setuptools, which will also install [b]easy_install[/b] on your system which you can use to automatically download and install Python packages. There is also an easy_install replacement called [b]pip[/b]. Of course, you install setuptools and pip from your distribution package manager. I'd suggest trying to [b]always use distribution-provided modules[/b], because otherwise you might overwrite some stuff you shouldn't. If you need a module that just isn't in your distribution, the best thing to do is, instead of using setup.py/easy_install/pip on the global Python installation, to first create a python sub-environment by using [b]virtualenv[/b]. Google it. It helps isolate official from unofficial modules and will let you have a per-application Python environment with a very small overhead. On OS X, it's more or less the same thing as Linux, except you should [b]REALLY[/b] watch out about overwriting system files. But you probably already messed around with that and know something about it if you updated the system-provided version of python using fink/ports/whatever.
Thank you very much for the reply. I have windows, but cannot find a installer for pip, setuptools, easy_install or virtualenv. On the note of using virtualenv, I found it, but I got a Distutils form file. Where should I put it and what should I do to install it? Also, does it show you that my browser is internet explorer and my OS is windows 7? It is showing those to me, and neither of them is correct. Edit: Check the OP please, this post seems to be correct.
You appear to be using Vista and Chrome(/ium). Not that it matters. On Windows, you wouldn't use pip, setuptools, easy_install of virtualenv. Almost all those modules are related to module management, which, again, on Windows, is done by just finding the package's binary installer. You can probably skip the parts in LPTHW about installing packages (as these probably only apply to Linux), and when you are requested to install a package, just find a Windows version of it. Alternatively, if you insist on using Linux-like packages, install Cygwin and use the utilities there. Remember however that the Python installation in Cygwin is isolated from your C:\Python2x installation. Also, since you'd be installing the packages via easy_install or pip, you'll have to have a valid compiling environment for some more complex modules (which are written in C). Which means having to have gcc, automake, and a lot of other dependencies installed, too.
Oh! Thank you. (Mexican hotel internet connection is messed up, displaying wrong for me).
Sorry, you need to Log In to post a reply to this thread.