将 Python 3.5 和 Tkinter 导出到 EXE 或 MSI
Exporting Python 3.5 and Tkinter to EXE or MSI
我正在使用 Python 3.5,我想导出我的 python 代码,以便发送给没有安装 Python 的其他人。事情是 Pyinstaller 不起作用,因为我收到此错误:
CX_Freeze 对我也不起作用,因为 Tkinter 仍然存在问题,在 运行 python setup.py build
我得到:
KeyError: 'TCL_LIBRARY'
坦率地说,我对此感到厌倦,因此我们将不胜感激。如果有帮助,这是我在代码中的导入
import pdb
from tkinter import *
from tkinter import filedialog
import tkinter.messagebox
from datetime import datetime, date, timedelta
import pandas as pd
import numpy as np
from xlsxwriter.utility import xl_rowcol_to_cell
如果您使用的是 cx_Freeze(<5.0) 的旧版本,它不支持 Python35。最新的开发版本有 Python35 支持。您可以通过
安装它
pip install cx-Freeze-win
但是您需要在系统上安装 VC++ 运行-time 才能 运行 成功。
我还发现这个 GitHub-repo 带有用于 windows 平台的 cx_Freeze 5 的预构建二进制包。
pip install wheel
https://raw.githubusercontent.com/sekrause/cx_Freeze-Wheels/master/cx_Freeze-5.0-cp35-cp35m-win_amd64.whl
好吧,我设法通过从网站下载 Pyinstaller 和 运行 新文件夹中的命令来让它工作。我按照这里 中的步骤操作。
我正在使用 Python 3.5,我想导出我的 python 代码,以便发送给没有安装 Python 的其他人。事情是 Pyinstaller 不起作用,因为我收到此错误:
CX_Freeze 对我也不起作用,因为 Tkinter 仍然存在问题,在 运行 python setup.py build
我得到:
KeyError: 'TCL_LIBRARY'
坦率地说,我对此感到厌倦,因此我们将不胜感激。如果有帮助,这是我在代码中的导入
import pdb
from tkinter import *
from tkinter import filedialog
import tkinter.messagebox
from datetime import datetime, date, timedelta
import pandas as pd
import numpy as np
from xlsxwriter.utility import xl_rowcol_to_cell
如果您使用的是 cx_Freeze(<5.0) 的旧版本,它不支持 Python35。最新的开发版本有 Python35 支持。您可以通过
安装它pip install cx-Freeze-win
但是您需要在系统上安装 VC++ 运行-time 才能 运行 成功。
我还发现这个 GitHub-repo 带有用于 windows 平台的 cx_Freeze 5 的预构建二进制包。
pip install wheel
https://raw.githubusercontent.com/sekrause/cx_Freeze-Wheels/master/cx_Freeze-5.0-cp35-cp35m-win_amd64.whl
好吧,我设法通过从网站下载 Pyinstaller 和 运行 新文件夹中的命令来让它工作。我按照这里