当我尝试将.py文件转换为exe时,我在命令提示符下出现此错误:
[Errno 2] No such file or directory: 'C:\\Program Files\\Python35\\tcl\\tcl8.6'
这是我的setup.py文件代码:
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = "C:\\Program Files\\Python35\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Program Files\\Python35\\tcl\\tk8.6"
setup (name = 'CODAQ Beta', version = '0.1', description = 'Aerosol Data Visualization Environment', executables = [Executable("CODAQ.py")])
我听说我可能需要更改os.environ['TCL_LIBRARY']
和os.environ['TK_LIBRARY']
,具体取决于我系统中tcl8.6
和tk.86
的路径。关于如何做到这一点的任何提示?
答案 0 :(得分:2)
找到解决方案:
tcl实际上是在Anaconda3:
这是我改变的代码:
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = "C:\\Program Files\\Anaconda3\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Program Files\\Anaconda3\\tcl\\tk8.6"
setup (name = 'CODAQ Beta', version = '0.1', description = 'Aerosol Data Visualization Environment', executables = [Executable("CODAQ.py")])