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

StackOverflow https://stackoverflow.com/questions/21359261

  •  02-10-2022
  •  | 
  •  

سؤال

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

هل كانت مفيدة؟

المحلول 2

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%").

نصائح أخرى

easy_install is a shell command line tool. Exit the python prompt and just type:

easy_install decorator

(the $ is typically found in documentation to represent the shell's prompt).

If that doesn't work, you'll probably need to run it as root: sudo easy_install decorator.1

1I'm assuming that you're on a unix-like system. If you're on windows, I can't help you ;-)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top