简体   繁体   English

Python 3导入模块错误:没有名为请求的模块

[英]Python 3 import module error: No module named request

Hello I am using python 3.4 on a Mac, Here is what I did- 您好,我在Mac上使用python 3.4,这是我所做的-

import urllib.request

when I run the code it comes back with this error- 当我运行代码时,它返回此错误-

ImportError: No module named request ImportError:没有名为请求的模块

when I do pip3 freeze here are my modules- 当我冻结pip3时,这是我的模块-

pip3 freeze
appdirs==1.4.3
beautifulsoup4==4.5.3
chardet2==2.0.3
html5lib==0.999999999
numpy==1.12.1
packaging==16.8
pandas==0.19.2
pyparsing==2.2.0
python-dateutil==2.6.0
pytz==2017.2
requests==2.13.0
six==1.10.0
urllib3==1.20
webencodings==0.5.1

What could be the issue? 可能是什么问题? thanks 谢谢

Solved with the help of tdelaney. 在tdelaney的帮助下解决了。

Had to change the way my text editor was excecuting the code from "python '%f'" to "python3 '%f'", otherwise it was using python 2. 必须将我的文本编辑器执行代码的方式从“ python'%f'”更改为“ python3'%f'”,否则使用的是python 2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM