当我尝试构建linux可执行文件时,它会成功构建,但当我尝试运行可执行文件时,它会显示此错误
Traceback (most recent call last):
File "pkgutil.py", line 637, in get_data
File "/home/user/.local/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 341, in get_data
with open(path, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEI4f5JfX/grpc/_cython/_credentials/roots.pem'
Exception ignored in: 'grpc._cython.cygrpc.ssl_roots_override_callback'
Traceback (most recent call last):
File "pkgutil.py", line 637, in get_data
File "/home/user/.local/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 341, in get_data
with open(path, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEI4f5JfX/grpc/_cython/_credentials/roots.pem'
E1122 03:58:17.060399901 23697 ssl_utils.cc:550] assertion failed: pem_root_certs != nullptr
Aborted (core dumped)
python文件 main.py
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db, firestore
# firebase app setup
cred = credentials.Certificate({
"type": "service_account",
"project_id": "project-216t8",
........
....
..
})
firebase_admin.initialize_app(cred)
def fetch_data():
doc_ref = DocCollection_ref
docs= doc_ref.get()
if docs.exists:
docs = docs.to_dict()
print(f'Document data: {docs.to_dict()}')
else:
print(u'No such document!')
fetch_data()
这个解决方案对我有效
您需要为依赖于setuptools'get_distribution()的包创建pyinstaller钩子,以获取有关包的元数据信息
在一些hooks目录中创建一个hook文件。文件名应为
hook-<modulename>.py
,以便pyinstaller正确找到它(即hook-gcloud.py
)解决方案: 创建两个钩子文件:
hook-gcloud.py
hook-grpc.py
在hook gcloud.py中编写以下代码并保存:
在hook grpc.py中编写以下代码并保存:
现在将这两个文件复制并粘贴到/lib/python3.8/site packages/PyInstaller/hooks/目录
相关问题 更多 >
编程相关推荐