简体   繁体   English

pyinstaller 无法使用 gspread 制作正确的 exe 文件。 ModuleNotFoundError:没有名为“gspread”的模块

[英]pyinstaller can't make correct exe file with gspread. ModuleNotFoundError: No module named 'gspread'

Pyinstaller doesn't see gspread. Pyinstaller 看不到 gspread。

import cv2 as cv
from time import time
import numpy as np
import dxcam
import gspread
import datetime
import wmi
from datetime import datetime, timedelta

All another lib of my project pyinstaller finding correctly.我的项目 pyinstaller 的所有另一个库都正确找到。

pyinstaller myProj.py

When i run the.exe i get: ModuleNotFoundError: No module named 'gspread'当我运行.exe时,我得到: ModuleNotFoundError: No module named 'gspread'

I tried copy all modules including gspread to the "dist\myProj" folder, after run the myProj.exe, i get this:我尝试将包括 gspread 在内的所有模块复制到“dist\myProj”文件夹,运行 myProj.exe 后,我得到了这个:

> C:\myProj\dist\myProj>myProj.exe Traceback (most recent call last):
> File " myProj.py", line 5, in <module> File
> "C:\myProj\dist\myProj\gspread\__init__.py", line 16, in <module> from
> .auth import oauth, service_account, service_account_from_dict File
> "C:\myProj\\dist\myProj\gspread\auth.py", line 16, in <module> from
> google_auth_oauthlib.flow import InstalledAppFlow File
> "C:\myProj\\dist\myProj\google_auth_oauthlib\__init__.py", line 21, in
> <module> from .interactive import get_user_credentials File
> "C:\myProj\\dist\myProj\google_auth_oauthlib\interactive.py", line 27,
> in <module> import google_auth_oauthlib.flow File
> "C:\myProj\\dist\myProj\google_auth_oauthlib\flow.py", line 63, in
> <module> import wsgiref.simple_server ModuleNotFoundError: No module
> named 'wsgiref' [2732] Failed to execute script 'myProj' due to
> unhandled exception!

What can i do to fix this?我能做些什么来解决这个问题?

first install package 'gspread' with your terminal like that:首先使用您的终端安装 package 'gspread' ,如下所示:

pip install gspread pip 安装 gspread

then make another exe file with this command:然后使用此命令制作另一个 exe 文件:

pyinstaller --onefile yourPythonFilename.py pyinstaller --onefile yourPythonFilename.py

then in your project library go to dist folder and the yourPythonFilename.exe file is the file you created.然后在您的项目库 go 到 dist 文件夹中, yourPythonFilename.exe文件就是您创建的文件。

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

相关问题 ModuleNotFoundError:没有名为“ gspread”的模块 - ModuleNotFoundError: No module named 'gspread' ModuleNotFoundError:没有名为“gspread.models”的模块 - ModuleNotFoundError: No module named 'gspread.models' 导入错误:没有名为 gspread 的模块 - ImportError: No module named gspread 没有名为“gspread”的模块,ModuleNotFoundError。 Python 中的导入问题 - No module named 'gspread', ModuleNotFoundError. Problem with import in Python Python 3.6没有名为&#39;gspread&#39;的模块-pyinstaller编译的可执行文件 - Python 3.6 no module named 'gspread' - pyinstaller compiled executable 尝试导入 gspread 时没有名为“gspread”的模块 - No module named 'gspread' when trying to import gspread Python,gspread。 我如何剪切或解析我的列表 - Python, gspread. How i can cut or parse my list “moduleNotFoundError:没有名为'pyautogui'的模块”仅在pyinstaller exe中 - "moduleNotFoundError: No module named 'pyautogui'" only in pyinstaller exe 我试图通过pyinstaller制作.exe文件时遇到此错误-“ ModuleNotFoundError:没有名为&#39;acrcloud_extr_tool&#39;的模块” - I'm getting this error when I'm trying to make an .exe file through pyinstaller - “ModuleNotFoundError: No module named 'acrcloud_extr_tool'” 导入错误:没有名为gspread或csv的模块? - Import error: No module named gspread or csv?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM