打包exe後路徑不同~請問哪裡出錯?
auto-py-to-exe 打包exe後路徑不同~請問哪裡出錯?
程序代码:
import os import requests from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor import re import time def resource_path(relative_path): """获取程序中所需文件资源的绝对路径""" try: # PyInstaller创建临时文件夹,将路径存储于_MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path) dir_path =resource_path('上傳資料夾') print(dir_path) time.sleep(86400)
[此贴子已经被作者于2023-1-11 19:34编辑过]