代码拉取完成,页面将自动刷新
import sys
import os
from cx_Freeze import setup, Executable
from src.config import version_
sys.path.append(r'../')
include_files = ['src', 'config.ini']
excludes_packages = ["tkinter", "test", 'unittest', 'multiprocessing', 'msilib', 'lib2to3', '_distutils_hack',
'greenlet', 'html', 'http', 'importlib_metadata', 'pydoc_data', 'setuptools', 'pkg_resources',
'libcrypto-1_1']
packages = ['PyQt5', 'numpy', 'pandas', 'pymysql', 'sqlalchemy', 'configobj']
base = 'Win32GUI' if sys.platform == 'win32' else None
options = {
'build_exe': {
# 'includes': ["pandas", "numpy", "openpyxl"],
'include_files': include_files,
'packages': packages,
"excludes": excludes_packages,
}
}
executables = [
Executable('PDMs.py', base=base, icon='icon/logo.ico'),
]
def transform(path, flag):
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)) and os.path.splitext(file)[-1] == '.py' or file in flag:
os.remove(os.path.join(path, file))
print('deleting {}'.format(os.path.join(path, file)))
elif os.path.isdir(os.path.join(path, file)) and file == '__pycache__':
for pyc_file in os.listdir(os.path.join(path, file)):
pyc_file_path = os.path.join(path, file, pyc_file)
if os.path.isfile(pyc_file_path) and os.path.splitext(pyc_file)[-1] == '.pyc':
rename = pyc_file.replace('.cpython-39', '', 1)
os.rename(pyc_file_path, os.path.join(path, rename))
print('moving {} to {}'.format(os.path.join(path, rename), pyc_file_path))
for root, dirs, files in os.walk(path):
for _dir in dirs:
if not os.listdir(os.path.join(root, _dir)):
os.rmdir(os.path.join(root, _dir))
def customer():
# 自定义函数
print('transforming py to pyc ...')
print('deleting py files...')
transform('build\\exe.win-amd64-3.9\\src', [])
transform('build\\exe.win-amd64-3.9\\PyQt5.uic.widget-plugins', [])
transform('build\\exe.win-amd64-3.9\\lib\\\PyQt5', ['python3.dll', 'python39.dll'])
setup(
name="PDMs",
options=options,
author='YanMing',
version=version_,
executables=executables,
description="Product Data Management System",
zip_safe=False
)
customer()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。