简体   繁体   English

将.py文件转换为exe时出错

[英]Error when converting .py file to exe

I'm getting this error in command prompt when I try to covert my .py file into an exe: 当我尝试将我的.py文件转换为exe时,在命令提示符中出现此错误:

[Errno 2] No such file or directory: 'C:\\\\Program Files\\\\Python35\\\\tcl\\\\tcl8.6'

Here's my setup.py file code: 这是我的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")])

I've heard that may I have to change os.environ['TCL_LIBRARY'] and os.environ['TK_LIBRARY'] depending on the path of tcl8.6 and tk.86 in my system. 我听说可能必须根据系统中tcl8.6tk.86的路径来更改os.environ['TCL_LIBRARY']os.environ['TK_LIBRARY'] Any tips on how to do this? 有关如何执行此操作的任何提示?

Found the solution: 找到了解决方案:

tcl was actually in Anaconda3: tcl实际上在Anaconda3中:

here's the code I changed: 这是我更改的代码:

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")])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM