Python - 导入错误:没有名为“请求”的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21493784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python - ImportError: No module named 'requests'
提问by mellover
I get this error when running code, so it appears that requests hasn't installed properly. I am running Windows 7 32-bit system with Python 3.3.
运行代码时出现此错误,因此请求似乎未正确安装。我正在使用 Python 3.3 运行 Windows 7 32 位系统。
When I go into 'Programs and Features' in windows it shows up as installed.
当我进入 Windows 中的“程序和功能”时,它显示为已安装。
I installed this program from http://www.lfd.uci.edu/~gohlke/pythonlibs/and I have also downloaded the requests folder and tried installing it this way, I can't seem to get this to work.
我从http://www.lfd.uci.edu/~gohlke/pythonlibs/安装了这个程序,我也下载了请求文件夹并尝试以这种方式安装它,我似乎无法让它工作。
I have visited ImportError: No module named 'requests'already, but I didn't find this helped at all.
我访问过ImportError: No module named 'requests'already,但我发现这根本没有帮助。
I keep seeing the following statement, but I am uncertain of how to run this?
我一直看到以下语句,但我不确定如何运行它?
$ python setup.py install
Please help!?!
请帮忙!?!
采纳答案by Aswin Murugesh
The answer there is clear. But let me explain to you as good as I can. This error comes because requests module is not installed in your system
那里的答案很明确。但让我尽我所能向你解释。出现此错误是因为您的系统中未安装请求模块
Download the requests module to your system from here
从这里将请求模块下载到您的系统
And extract it. Go to your command prompt/terminal and reach to the folder you downloaded.There, you will see setup.py, the file that you need to execute to install the requests module.
并提取它。转到您的命令提示符/终端并到达您下载的文件夹setup.py。在那里,您将看到安装请求模块需要执行的文件。
python setup.py install
Installs the requests module
安装请求模块
回答by Diegomanas
This line:
这一行:
$ python setup.py install
It's a command line in a terminal in Linux or the alike. My guess is that you could do the same opening a terminal in Windows pressing the start key and typing 'cmd', without quotes of course. If you had python already install the %PATH% variable should be set up properly and it should just run. Well, perhaps you need to go to the same folder as the setup.py using
它是 Linux 或类似终端中的命令行。我的猜测是,您可以在 Windows 中按开始键并键入“cmd”来打开一个终端,当然没有引号。如果你已经安装了 python %PATH% 变量应该正确设置并且它应该运行。好吧,也许您需要使用与 setup.py 相同的文件夹
> cd path_to_file
And then,
进而,
> python setup.py install
I hope it helps. Let me know otherwise.
我希望它有帮助。否则让我知道。
回答by 100mil
If you are using Ubuntu, there is need to install requests
如果您使用的是 Ubuntu,则需要安装 requests
run this command:
运行这个命令:
pip install requests
pip install requests
if you face permission denied error, use sudo before command:
如果您遇到权限被拒绝错误,请在命令前使用 sudo:
sudo pip install requests
sudo pip install requests

