在python 2.7窗口中安装请求模块

时间:2021-03-31 20:23:12

I am facing issues while installing request module (python 2.7) on windows.

我在Windows上安装请求模块(python 2.7)时遇到问题。

Tries the below steps as per docuemntation:

根据docuemntation尝试以下步骤:

1

1

pip install requests

pip安装请求

error

错误

'pip' is not recognized as an internal or external command, operable program or batch file.

'pip'不被识别为内部或外部命令,可操作程序或批处理文件。

2

2

easy_install requests

easy_install请求

error

错误

'easy_install' is not recognized as an internal or external command, operable program or batch file.

'easy_install'不被识别为内部或外部命令,可操作程序或批处理文件。

3

3

setup.py

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上安装模块,而无需下载任何新的东西。

4 个解决方案

#1


6  

There are four options here:

这里有四个选项:

  1. Get virtualenv set up. Each virtual environment you create will automatically have pip.

    设置virtualenv。您创建的每个虚拟环境都将自动拥有pip。

  2. Get pip set up globally.

    获取全球点子设置。

  3. 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安装一样简单,但并非总是如此。

  4. Use Christoph Gohlke's binary installers.

    使用Christoph Gohlke的二进制安装程序。

#2


35  

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

python.exe -m pip安装请求

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

python -m pip安装请求

#3


3  

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

#4


-5  

  1. Download the source code(zip or rar package).
  2. 下载源代码(zip或rar包)。
  3. Run the setup.py inside.
  4. 在里面运行setup.py。

#1


6  

There are four options here:

这里有四个选项:

  1. Get virtualenv set up. Each virtual environment you create will automatically have pip.

    设置virtualenv。您创建的每个虚拟环境都将自动拥有pip。

  2. Get pip set up globally.

    获取全球点子设置。

  3. 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安装一样简单,但并非总是如此。

  4. Use Christoph Gohlke's binary installers.

    使用Christoph Gohlke的二进制安装程序。

#2


35  

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

python.exe -m pip安装请求

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

python -m pip安装请求

#3


3  

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

#4


-5  

  1. Download the source code(zip or rar package).
  2. 下载源代码(zip或rar包)。
  3. Run the setup.py inside.
  4. 在里面运行setup.py。