[英]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.