[英]installing requests module in python 2.7 windows
I am facing issues while installing request module (python 2.7) on windows. 我在Windows上安装请求模块(python 2.7)时遇到问题。
Tried the below steps as per documentation: 按照文档尝试以下步骤:
1 1
pip install requests
error 错误
'pip' is not recognized as an internal or external command, operable program or batch file.
2 2
easy_install requests
error 错误
'easy_install' is not recognized as an internal or external command, operable program or batch file.
3 3
setup.py
error 错误
C:\Location\Python\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'zip_safe' warnings.warn(msg)
C:\Location\Python\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'include_package_data' warnings.warn(msg)
C:\Location\Python\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
Can anyone please advise how to install the module on windows , without downloading any new stuff. 任何人都可以建议如何在Windows上安装模块,而无需下载任何新的东西。
If you want to install requests directly you can use the "-m" (module) option available to python. 如果要直接安装请求,可以使用python可用的“-m”(模块)选项。
python.exe -m pip install requests
You can do this directly in PowerShell, though you may need to use the full python path (eg. C:\\Python27\\python.exe
) instead of just python.exe
. 您可以直接在PowerShell中执行此操作,但您可能需要使用完整的python路径(例如C:\\Python27\\python.exe
)而不仅仅是python.exe
。
As mentioned in the comments, if you have added Python to your path you can simply do: 如评论中所述,如果您已将Python添加到路径中,则可以执行以下操作:
python -m pip install requests
There are four options here: 这里有四个选项:
Get virtualenv
set up. 设置virtualenv
。 Each virtual environment you create will automatically have pip
. 您创建的每个虚拟环境都将自动拥有pip
。
Learn how to install Python packages manually—in most cases it's as simple as download, unzip, python setup.py install
, but not always. 了解如何手动安装Python软件包 - 在大多数情况下,它就像下载,解压缩, python setup.py install
一样简单,但并非总是如此。
Use Christoph Gohlke's binary installers . 使用Christoph Gohlke的二进制安装程序 。
On windows 10 run cmd.exe with admin rights then type : 在Windows 10上运行具有管理员权限的cmd.exe,然后键入:
1) cd \\Python27\\scripts 1)cd \\ Python27 \\ scripts
2) pip install requests 2)pip安装请求
It should work. 它应该工作。 My case was with python 2.7 我的情况是使用python 2.7
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.