如何从 Windows 中的 Python 包索引安装装饰器包? [英] How do you install the decorator package from the Python package index in Windows?
问题描述
我进入 python 命令行并输入 $ easy_install 装饰器,就像它在网站上所说的那样 https://pypi.python.org/pypi/decorator
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
推荐答案
听起来您使用的是 Windows,因此我将为您提供一种非常简单的 Windows 友好方式来安装 Python 包.
It sounds like you're on Windows, so I will provide you with an extremely simple Windows-friendly way to install the Python package.
- 获取
get-pip.py
来自 pip-installer.org - 使用您安装的任何 Python 版本执行
get-pip.py
- 使用步骤2中获得的新
pip.exe
工具安装decorator
包
如果您在 C:\Python27
中安装了 Python 2.7,步骤 2 和 3 将如下所示:
If you have Python 2.7 installed in C:\Python27
, steps 2 and 3 will look like this:
C:\Python27\python.exe get-pip.py
C:\Python27\Scripts\pip.exe 安装装饰器
我现在没有一台 Windows 机器在我面前运行;所以,如果我记错了,并且我上面列出的示例命令对您不起作用,请告诉我.就像 mgilson 在他的回答中指出的那样,您需要从命令提示符执行这些命令(从开始"菜单运行 cmd.exe
).
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).
为了将来参考,将您的 Python 安装路径和它的 Scripts
子目录添加到您系统的 PATH
环境变量中,可以让这样的操作变得不那么麻烦.您可以使用 setx
(例如 setx PATH "C:\Python27;C:\Python27\Scripts;%PATH%"
)来执行此操作.
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%"
).
这篇关于如何从 Windows 中的 Python 包索引安装装饰器包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!