def remove_all_file(filepath, file_name):
"""
删除 MAC 临时文件
:param file_name:
:return:
"""
for root, dirs, files in os.walk(filepath):
for name in files:
print(name)
if name.startswith("._") or name == file_name:
os.remove(os.path.join(root, name))
接着,我们利用pyinstaller将Python文件打包成Exe可执行文件。 ; ]1 B* d9 x/ G
# 安装 pyinstaller * Z8 X4 i5 C9 B1 A. _) ^, |7 v
pip3 install pyinstaller 6 Y0 s, U. h2 h1 B& I
# 把 py 文件打包成 exe 可执行文件+ @( s% [6 j$ l q6 y# x3 t
# 图标:img.ico0 @+ a0 R, M) U3 a
pyinstaller -F -i img.ico del_mac_files.py