使用pyinstaller将以下代码转换为.exe后,使用dist-folder中的.exe后,程序无法将csv文件从dict data = {}
写入输出路径data_path_out
。
我以前尝试过将我的python文件链接到test.lnk,效果很好。https://i.stack.imgur.com/ow7mo.png
import os
from os.path import join, dirname
import pathlib
import csv
data_path_in = pathlib.Path(join(dirname(__file__), "00_Data"))
data_path_out = pathlib.Path(join(dirname(__file__), "01_Results"))
data = {}
with open(join(data_path_in, "Data.txt"), "r") as csv_file:
r = csv.reader(csv_file, delimiter= ",")
for row in r:
data[row[0]] = row[1]
with open(join(data_path_out, "Results.txt"), "w") as csv_file:
wr = csv.writer(csv_file, dialect = "excel")
for key, value in data.items():
wr.writerow([key, value])
1条答案
按热度按时间jdgnovmf1#
正如评论中提到的,用Pyinstaller转换的应用程序通常被视为病毒,你可以尝试使用Nuitka