ModuleNotFoundError: No module named ‘aiohttp’ python3.10

huangapple go评论48阅读模式
英文:

ModuleNotFoundError: No module named 'aiohttp' python3.10

问题

我一直在尝试将我的代码制作成一个.exe文件,但我面临着这个错误:

ModuleNotFoundError: No module named 'aiohttp'

我尝试过卸载然后重新安装。我尝试重新开始这个项目,以确保它没有获取不同版本的包,但似乎一切都不起作用。它只是无法加载或将库压缩版本。它已经在虚拟环境中使用。

当我在我的IDE中运行文件时,它运行得很好。我已经阅读了一些互联网上的文章,但我仍然无法解决。

如果有人之前遇到过这个问题,我将非常乐意得到任何帮助。

Python版本:3.10
aiohttp版本:3.8.1

要导入的模块正常。

英文:

I've been trying to make a .exe file out of my code, but i'm facing this error:

ModuleNotFoundError: No module named 'aiohttp'

I tried to uninstall and install again. I tried to start over the project, to make sure it wasnt get a different version of the package, but nothing seems to work.It just doesn't load or the lib to the compact version. It's been used in a virtual environment.

When i run the file in my IDE, it works just fine. I've read a couple of articles in the internet, but I still couldn't fix.

If anyone faced this before. I'd be gladly to get any help.

Python -version 3.10
aiohttp==3.8.1

The module to be imported just fine

答案1

得分: 1

只返回翻译好的部分:

"我不知道为什么,但在转换为可执行文件时,某种原因导致它无法获取虚拟环境的库路径。
所以我不得不手动设置包所在的路径。

示例:

pyinstaller --noconfirm --onedir --console --paths "C:/Users/user/PycharmProjects/ProjectName/venv/Lib/site-packages" "C:/Users/user/PycharmProjects/ProjectName/main.py""

英文:

I don't know why. but when converting to exe, somehow it wasn't getting the lib path of my virtual enviroment.
So what I had to do was set manually the path where the packges were located.

Example:

pyinstaller --noconfirm --onedir --console --paths "C:/Users/user/PycharmProjects/ProjectName/venv/Lib/site-packages" "C:/Users/user/PycharmProjects/ProjectName/main.py"

huangapple
  • 本文由 发表于 2023年2月23日 19:49:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/75544435.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定