ImportError没有名为request的模块

时间:2017-09-28 14:44:41

标签: python django opencv

C:\Users\james\Desktop\FaceRecognitionAPI-master\FaceRecognitionAPI-master>python manage.py runserver Performing system checks...

Unhandled exception in thread started by <function wrapper at 0x037446B0> Traceback (most recent call last): File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 116, in inner_run self.check(display_num_errors=True) File "C:\Python27\lib\site-packages\django\core\management\base.py", line 426, in check include_deployment_checks=include_deployment_checks, File "C:\Python27\lib\site-packages\django\core\checks\registry.py", line 75, in run_checks new_errors = check(app_configs=app_configs) File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 10, in check_url_config return check_resolver(resolver) File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 19, in check_resolver for pattern in resolver.url_patterns: File "C:\Python27\lib\site-packages\django\utils\functional.py", line 33, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 417, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Python27\lib\site-packages\django\utils\functional.py", line 33, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 410, in urlconf_module return import_module(self.urlconf_name) File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) File "C:\Users\james\Desktop\FaceRecognitionAPI-master\FaceRecognitionAPI-master\facerec\urls.py", line 6, in <module> from api import views File "C:\Users\james\Desktop\FaceRecognitionAPI-master\FaceRecognitionAPI-master\api\views.py", line 9, in <module> import urllib.request ImportError: No module named request

2 个答案:

答案 0 :(得分:1)

I don't believe there's a urllib.request in Python 2, only 3.

答案 1 :(得分:0)

Python 2中的 urllib.requests不存在,{3}}模块在​​Python 3中拆分并重命名

  

urllib模块已拆分为多个部分,并在Python 3中重命名为   urllib.request,urllib.parse和urllib.error。 2to3工具将   将源转换为Python 3时自动调整导入。   另请注意,Python 3中的urllib.request.urlopen()函数是   相当于urllib2.urlopen()和urllib.urlopen()   除去。