Python 无法从six.moves.http_客户端导入HTTPConnection

Python 无法从six.moves.http_客户端导入HTTPConnection,python,Python,我是python新手,在尝试从six.moves.http_客户端进行基本导入时遇到问题 我已在pip上将六个更新为最新版本: $ pip show six --- Metadata-Version: 2.0 Name: six Version: 1.10.0 Summary: Python 2 and 3 compatibility utilities Home-page: http://pypi.python.org/pypi/six/ Author: Benjamin Peterson A

我是python新手,在尝试从six.moves.http_客户端进行基本导入时遇到问题

我已在pip上将六个更新为最新版本:

$ pip show six
---
Metadata-Version: 2.0
Name: six
Version: 1.10.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /Library/Python/2.7/site-packages
Requires:
但是,当尝试从http_客户端导入HTTPConnection时,会出现一个错误:

$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from six.moves.http_client import HTTPConnection
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named http_client
$python
Python 2.7.10(默认值,2015年7月14日,19:46:27)
[GCC 4.2.1达尔文兼容苹果LLVM 6.0(clang-600.0.39)]
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>从six.moves.http_客户端导入HTTPConnection
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为http\U客户端的模块
但我确实可以从six.moves导入http_客户端

>>> from six.moves import http_client
>>> http_client.responses
{200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non-Authoritative Information', 204: 'No Content', 205: 'Reset Content', 206: 'Partial Content', 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', 403: 'Forbidden', 404: 'Not Found', 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout', 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Request Entity Too Large', 414: 'Request-URI Too Long', 415: 'Unsupported Media Type', 416: 'Requested Range Not Satisfiable', 417: 'Expectation Failed', 100: 'Continue', 101: 'Switching Protocols', 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified', 305: 'Use Proxy', 306: '(Unused)', 307: 'Temporary Redirect', 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable', 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported'}
>>> http_client.HTTPConnection
<class httplib.HTTPConnection at 0x106de96d0>
>>从six.moves导入http\u客户端
>>>http_client.responses
{200:'确定'、201:'创建'、202:'接受'、203:'非权威信息'、204:'无内容'、205:'重置内容'、206:'部分内容'、400:'错误请求'、401:'未授权'、402:'需要支付'、403:'禁止'、404:'未找到'、405:'方法不允许'、406:'不可接受'、407:'需要代理身份验证'、408:'重新请求'st Timeout',409:'冲突',410:'消失',411:'长度要求',412:'前置条件失败',413:'请求实体太大',414:'请求URI太长',415:'不支持的媒体类型',416:'请求的范围不可满足',417:'期望失败',100:'继续',101:'切换协议',300:'多选',301:'永久移动',302:'找到',303:'查看其他',304:'未修改',305:'使用代理',306:'未使用',307:'临时重定向',500:'内部服务器错误',501:'未实现',502:'坏网关',503:'服务不可用',504:'网关超时',505:'不支持HTTP版本'}
>>>http_client.HTTPConnection

谁能告诉我我在这里完全遗漏了什么吗?

six使用复杂的导入技巧来实现它的魔力。您可以在源代码中查看类_SixMetaPathImporter。没有真正的包six.moves.http\u客户端。

six使用复杂的导入技巧来实现它的魔力。您可以在源代码中查看类_SixMetaPathImporter。没有真正的包six.moves.http_客户端