当我通过以下命令创建exe文件时
pyinstaller --hidden-import=pkg_resources.py2_warn --onefile example.py
它工作得很好,并将我的python脚本转换为。exe,但当我将该文件复制到其他位置时,它不工作,并说不能打开自错误,然后我尝试了以下尝试,都失败了
我已将我的。exe中所需的所有图标复制到同一个文件夹中
pyinstaller --debug --onefile --noupx test.py#same error
错误(试图复制错误,但无法复制,因为控制台停留了几秒钟,并自动关闭)
cannotopenself (then it gives the location where I copied my newly made .exe file)
然后我尝试使用CX_FREEZE,然后它又说没有发现tkinter模块错误
我已经在我的脚本所在的主文件中包含了所有所需的DLL文件,但仍然给出了tkinter not found错误,尝试了以下方法
from cx_Freeze import setup, Executable
# imported tkinter here also
from tkinter import *
import sys
import os.path
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], 'includes':["tkinter"],'include_files':['tk86t.dll','tcl86t.dll','text.ico','viewer.ico']}
# included tkinter also
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "MINE",
version = "0.1",
description = "MY FILE",
options = {"build_exe": build_exe_options},
executables = [Executable("EXAMPLE.py", base=base)])
from cx_Freeze import setup, Executable
from tkinter import *
import sys
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os","numpy","time","optparse","linecache","pandas",
"matplotlib","PIL","tk"],'include_files':['tcl86t.dll','tk86t.dll','graphs.ico','viewer.ico']}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "My file",
version = "0.1",
description = "MY FILE ",
options = {"build_exe": build_exe_options},
executables = [Executable("My_file.py", base=base)])
这是我们在使用cx_freeze时需要遵循的方法
a)首先从您安装了python的python文件夹中复制tk86t.dll和tcl86t.dll,主要是在本地文件夹的app_data中,然后复制到您有setup.py文件的地方
b)然后在通过pip install cx_freeze
安装后的pycharm终端类型中
from cx_Freeze import setup, Executable
from tkinter import *
import sys
import os.path
import mpl_toolkits
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os","numpy","time","optparse","linecache","pandas",
"matplotlib","PIL","tk"],"namespace_packages":['mpl_toolkits'],'include_files':['tcl86t.dll','tk86t.dll']}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "Your file",
version = "0.1",
description = "your file",
options = {"build_exe": build_exe_options},
executables = [Executable("yourfile.py", base=base)])
现在,在构建之后,转到构建文件夹,在win32文件夹中转到lib,然后将Tkinter文件夹的名称改为Tkinter,现在运行您的应用程序
我setup.py密码是 谁能帮我解决这个问题。
我的申请有什么问题?
问题: 1.当我尝试安装在python或通过cmd它说: 错误:系统找不到路径:'C:\Program Files(x86)\Microsoft SDK\Windows\v8.1\lib' 正如您看到的,上面写着但我有。在我看来,这就是问题所在,但我该如何解决它呢? 2.我也下载了并在cmd中尝试了这个: python-mpip安装C:\Users\Super\Downloads\cx\u Fre
我得到一个Chrome驱动程序相关的错误时运行我的Selenium测试。错误消息是“无法发现打开的页面”。硒测试一直到昨天晚上都正常。问题似乎是在前一天重新启动服务器后开始的。我无法在本地框上复制此错误。在服务器上从命令行运行Selenium测试确实会打开Chrome浏览器,但会导致相同的错误。有什么想法吗? 无法发现OpenQa.Selenium.Remote.RemoteWebDriver.U
但当我从另一个位置(如root或其他位置)运行时,它会抛出一个错误: 线程“main”java.lang.RuntimeException中出现异常:无法在org.apache.hadoop.hive.ql.util.ResourceDownLoader.ensureDirectory(resourceDownLoader.java:123)(org.apache.hadoop.hive.ql.u
我将按照本教程在pygame中制作一个蛇形游戏。这是我的设置。py代码: 当我试图在命令提示符中构建它时,我得到了这个错误 C:\Users\Accounts\Documents\snake 文件“C:\Python35\lib\os.py”,第681行,在getitem中,从None-KeyError:TCL\u-LIBRARY'KeyError:TCL\u-LIBRARY' 而且它不能建立。有