我无法导入aiohttp,但好像已经安装了

时间:2019-01-31 09:02:50

标签: python

我无法导入aiohttp,但好像已经安装了它。尝试导入时,出现以下错误。

我尝试卸载aiohttp,然后重新安装多次。

我的代码:

import aiohttp

错误:

Traceback (most recent call last):
  File "/Users/shiling1/PycharmProjects/python_code/111.py", line 1, in <module>
    import aiohttp
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/aiohttp/client.py", line 12, in <module>
    from typing import ( #noqa
ImportError: cannot import name 'Coroutine'

安装aiohttp

$ pip install aiohttp -t /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/

Collecting aiohttp
  Using cached https://files.pythonhosted.org/packages/16/60/c6ac986c2caeab6d3bae1e0b3400ab49df3aff23a8e37c543be68780d014/aiohttp-3.5.4-cp37-cp37m-macosx_10_13_x86_64.whl
Collecting yarl<2.0,>=1.0 (from aiohttp)
Collecting multidict<5.0,>=4.0 (from aiohttp)
  Using cached https://files.pythonhosted.org/packages/0e/64/39b167d63e292cc2336d09c4d3577089db82cd7886ed535b6100fc7c7966/multidict-4.5.2-cp37-cp37m-macosx_10_12_intel.macosx_10_12_x86_64.macosx_10_13_intel.macosx_10_13_x86_64.whl
Collecting attrs>=17.3.0 (from aiohttp)
  Using cached https://files.pythonhosted.org/packages/3a/e1/5f9023cc983f1a628a8c2fd051ad19e76ff7b142a0faf329336f9a62a514/attrs-18.2.0-py2.py3-none-any.whl
Collecting async-timeout<4.0,>=3.0 (from aiohttp)
  Using cached https://files.pythonhosted.org/packages/e1/1e/5a4441be21b0726c4464f3f23c8b19628372f606755a9d2e46c187e65ec4/async_timeout-3.0.1-py3-none-any.whl
Collecting chardet<4.0,>=2.0 (from aiohttp)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna>=2.0 (from yarl<2.0,>=1.0->aiohttp)
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Installing collected packages: idna, multidict, yarl, attrs, async-timeout, chardet, aiohttp
Successfully installed aiohttp-3.5.4 async-timeout-3.0.1 attrs-18.2.0 chardet-3.0.4 idna-2.8 multidict-4.5.2 yarl-1.3.0

0 个答案:

没有答案