Saturday, March 24, 2012

How to download PIP for Python 3 under Windows 8

distribute_setup.py
Right click and save the above target


Then click the search button for windows.

Type CMD
to open up a shell.

add python to path
SET PATH=%PATH%;c:\Python32
then CD over to where you saved distribute_setup

execute it
python distribute_setup.py

Now download pip, extract it using 7Zip

http://www.pip-installer.org/en/latest/installing.html

type
python get-pip.py

If you don't do these steps in order you might get an error about setuptools module not installed.

Now you need to add the scripts folder of python where easy_install and now pip resides

Back to the command prompt
set PATH=%PATH%;c:\Python32\Scripts

Now you can install all 20000 packages on
http://pypi.python.org/pypi

So in your DOS shell, type pip install [packagename]


EXAMPLE
C:\Users\Omar\Desktop>pip install pyatom
Downloading/unpacking pyatom
  Real name of requirement pyatom is pyatom
  Downloading pyatom-1.2.tar.gz
  Running setup.py egg_info for package pyatom
Installing collected packages: pyatom
  Running setup.py install for pyatom
      File "c:\Python32\Lib\site-packages\pyatom.py", line 61
        return u'<%s type="xhtml"><div xmlns="%s">%s</div></%s>\n' % \
                                                                 ^
    SyntaxError: invalid syntax

Successfully installed pyatom
Cleaning up...
C:\Users\Omar\Desktop>


MODULES is another name for PACKAGES
make sure no script has the same name as your package
so you can't name your script pyatom or you will get an error
Python: Idle: ImportError: cannot import name pyatom

No comments:

Post a Comment