Search code examples
pythonmodulepackagepypi

How do you install the decorator package from the Python package index in Windows?


I went into the python command line and typed $ easy_install decorator like how it says on the website https://pypi.python.org/pypi/decorator


Solution

  • It sounds like you're on Windows, so I will provide you with an extremely simple Windows-friendly way to install the Python package.

    1. Obtain get-pip.py from pip-installer.org
    2. Execute get-pip.py using whichever version of Python you have installed
    3. Use the new pip.exe tool obtained in step 2 to install the decorator package

    If you have Python 2.7 installed in C:\Python27, steps 2 and 3 will look like this:

    1. C:\Python27\python.exe get-pip.py
    2. C:\Python27\Scripts\pip.exe install decorator

    I don't have a Windows machine running in front of me right now; so, let me know if my memory has failed me and the example commands I listed above do not work for you. Like mgilson pointed out in his answer, you need to execute these commands from a command prompt (run cmd.exe from the Start Menu).

    For future reference, adding your Python installation path and its Scripts subdirectory to your system's PATH environment variable make operations like this a lot less cumbersome. You can do this using setx (e.g. setx PATH "C:\Python27;C:\Python27\Scripts;%PATH%").