0

我需要帮助隐藏我使用 Pyinstaller 库创建的可执行文件中的警告,下面是我在创建可执行文件时使用的命令。

pyinstaller -y -F "D:/Vipul Garg Backup/ABCD/PythonScript/DataTransformationFile.py"

我正在使用 Pyinstaller 版本 3.6 和 Python 3.7.5,并且我尝试在 .spec 文件中进行以下更改。

1.for d in a.datas:
    if 'pyconfig' in d[0]: 
        a.datas.remove(d)
        break   
2.a.datas = list({tuple(map(str.upper, t)) for t in a.datas})

但是没有任何结果,它仍然在下面发出警告。

WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File "site-packages\pygsheets\sheet.py", line 37, in __init__
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\VIPUL~1.GAR\\AppData\\Local\\Temp\\_MEI165202\\pygsheets\\data\\sheets_discovery.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\__init__.py", line 36, in autodetect
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 33, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 37, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\__init__.py", line 41, in autodetect
  File "c:\users\vipul.garg\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 41, in <module>
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File "site-packages\pygsheets\drive.py", line 49, in __init__
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\VIPUL~1.GAR\\AppData\\Local\\Temp\\_MEI165202\\pygsheets\\data\\drive_discovery.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\__init__.py", line 36, in autodetect
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 33, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 37, in <module>
ModuleNotFoundError: No module named 'oauth2client'

我在我的脚本中使用以下导入。

import pandas as pd
from pandas import ExcelWriter
from datetime import date
import csv
from xlsxwriter.workbook import Workbook
import glob
import json
import os
import sys
import warnings
import pygsheets
import time
import smtplib
import linecache

我已将以下代码添加到我的 python 文件中以忽略警告,当我通过 Pycharm 运行我的 python 脚本时,它没有向我显示任何类型的警告。

 if not sys.warnoptions:
    warnings.simplefilter("ignore")
4

0 回答 0