Install Python Packages on Windows 7

You want to use Python on a Windows 7 machine but you don't know what you're doing. What you do know is that in order to go anywhere and do anything you've got to install packages. Or maybe you don't even know that yet. Take a look at the top of any Python code and you'll likely see a line like this: import thingamajig .

In Python, as with Java and its derivatives, you're always importing some established code into your project. If you're new to Python, new to Command Prompt, and new to anything non-Windows, then you're going to need a hand with that first step.

At the time of this draft, Python 2.7 is the stable install. Download Python from http://www.python.org/ and install it at C:\Python27\ For users with 64-bit systems, the 32-bit version of all software is recommended.

Steps

  1. Open the Command Prompt.
  2. Go to your Start Menu. Start > All Programs > Accessories > Command Prompt.
  3. Type into the Command Prompt window:
    • set path=%path%;C:\Python27\
  4. And hit enter.
  5. Download simplejson at http://pypi.python.org/pypi/simplejson.
  6. This is a simplejson-2.1.6.tar.gz file, which in Windows language means it is a strange and otherworldly kind of zip file.
  7. To open the *tar.gz file, download PeaZip for Windows http://peazip.org/
  8. Use PeaZip to extract (uncompress / unzip) simplejson-2.1.6.tar.gz into your Download directory.
  9. You should end up with something similar to this: C:\Users\pdxNat\Downloads\simplejson-2.1.6\
  10. Go back to your Command Prompt window or open a new one.
  11. You'll need to change directories in the command line and here's how you do that (http://coweb.cc.gatech.edu/ice-gt/339 )
  12. When you start, your command line should look something like this:
    • c:\Users\pdxNat>
  13. You want to get into the simplejson-2.1.6 directory, so at the command prompt type this:
    • cd downloads\simplejson-2.1.6
      • or the complete path:
    • cd c:\Users\pdxNat\Downloads\simplejson-2.1.6
  14. Your prompt will change from this
  15. c:\Users\pdxNat>
  16. to this
  17. c:\Users\pdxNat\Downloads\simplejson-2.1.6>
  18. Now for the fun part. Inside that simplejson directory there is a file called setup.py. We're going to install that into the Python universe. Type this into the Command Prompt :
  19. For Windows 7 64 bit users, type: setup.py install. For other windows users type: python setup.py install
  20. See all that stuff flying by? Forget about it. Open a Windows Explorer window (Start > All Programs > Accessories > Windows Explorer ) and go have a look inside the directory at C:\Python27\Lib\site-packages\
  21. You'll see simplejson-2.1.6-py2.7.egg has been added to the directory.
  22. Now open IDLE (Start > All Programs > Python 2.7 > IDLE (Python GUI)) and type the following:
  23. >>> import simplejson
  24. See all that nothing that happens? That's your sign of success. Congratulations.
  25. You've just installed and imported your first package for Python on Windows 7.
  26. Repeat as needed.
  27. For more information, see http://docs.python.org/tutorial/index.html and http://www.python-forum.org.
  28. Download a package.
  29. Extract the package
  30. Open Command Prompt
  31. Set path (1st time only)
  32. Change directory to Download\package\
  33. Type >python setup.py install.

Windows MSI installer

  1. Download the Windows MSI installer (either x86 or x64).
  2. Run the program.
  3. Take note of the path during the installation. For example, C:\Python33\ if you want to use the command line.
  4. If you do not care to use the command line, you can now use the IDLE integrated development environment for Python and consider yourself done.
  5. If you want to use the command line, click on Control Panel.
  6. Click on System and Security.
  7. Click on System.
  8. Click on the Advanced system settings link.
  9. Click on the Environmental Variables button.
  10. Under System Variables, look for the Variable named Path.
  11. Select Path and click on the Edit button.
  12. At the end of the Variable value, add the value you took note of in step 3 (i.e. C:\Python33\) preceded by a semicolon (;) which is used to separate the values, so you would add - ;C:\Python33\.
  13. Open your command line and type 'python' - if successful, you should see three greater than symbols at the command prompt (>>>).
  14. To exit the Python interpreter, type 'exit()'.
  15. That's it!