简体   繁体   English

aiohttp 模块 - 导入错误

[英]aiohttp module - import error

Installed aiohttp ,安装aiohttp

pip3 install aiohttp

as mentioned here正如这里提到的


With python3.6,使用python3.6,

I see below error:我看到以下错误:

import aiohttp
ModuleNotFoundError: No module named 'aiohttp'

How to resolve this error?如何解决此错误?

This is because your pip3 is not in the python3.6 PYTHONPATH. 这是因为你的pip3不在python3.6 PYTHONPATH中。 I always think the best way to install Python packages using pip is with to run it as a script using the -m option. 我一直认为使用pip安装Python包的最佳方法是使用-m选项将其作为脚本运行。

python3.6 -m pip install aiohttp

I had this issue even on Pycharm.我什至在 Pycharm 上也遇到了这个问题。 After figuring out which interpreter I use I had to explicitly install aiohttp with pip with the python binary under venv/bin.在弄清楚我使用哪个解释器之后,我必须在 venv/bin 下使用 python 二进制文件显式安装带有 pip 的 aiohttp。

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

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