Fix tcl/tk libs inclusion in tkinter with Python3.7 under MacOS

使用 Pyinstaller 打包时候报错

3027 ERROR: Tcl/Tk improperly installed on this system.
(lyj_venv) ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj] pyinstaller --windowed --onefile --clean --noconfirm ServenDigitsDrawV2.py
77 INFO: PyInstaller: 3.4
77 INFO: Python: 3.7.3
84 INFO: Platform: Darwin-18.5.0-x86_64-i386-64bit
85 INFO: wrote /Users/liyongjian/lyj/ServenDigitsDrawV2.spec
88 INFO: UPX is not available.
89 INFO: Removing temporary files and cleaning cache in /Users/liyongjian/Library/Application Support/pyinstaller
96 INFO: Extending PYTHONPATH with paths
['/Users/liyongjian/lyj', '/Users/liyongjian/lyj']
96 INFO: checking Analysis
96 INFO: Building Analysis because Analysis-00.toc is non existent
96 INFO: Initializing module dependency graph...
97 INFO: Initializing module graph hooks...
99 INFO: Analyzing base_library.zip ...
2805 INFO: running Analysis Analysis-00.toc
2814 INFO: Caching module hooks...
2817 INFO: Analyzing /Users/liyongjian/lyj/ServenDigitsDrawV2.py
3015 INFO: Loading module hooks...
3015 INFO: Loading module hook "hook-_tkinter.py"...
3027 ERROR: Tcl/Tk improperly installed on this system.
3027 INFO: Loading module hook "hook-encodings.py"...
3086 INFO: Loading module hook "hook-xml.py"...
3281 INFO: Loading module hook "hook-pydoc.py"...
3292 INFO: Looking for ctypes DLLs
3292 INFO: Analyzing run-time hooks ...
3295 INFO: Including run-time hook 'pyi_rth__tkinter.py'
3303 INFO: Looking for dynamic libraries
3411 INFO: Looking for eggs
3411 INFO: Using Python library /Library/Frameworks/Python.framework/Versions/3.7/Python
3413 INFO: Warnings written to /Users/liyongjian/lyj/build/ServenDigitsDrawV2/warn-ServenDigitsDrawV2.txt
3439 INFO: Graph cross-reference written to /Users/liyongjian/lyj/build/ServenDigitsDrawV2/xref-ServenDigitsDrawV2.html
3446 INFO: checking PYZ
3446 INFO: Building PYZ because PYZ-00.toc is non existent
3447 INFO: Building PYZ (ZlibArchive) /Users/liyongjian/lyj/build/ServenDigitsDrawV2/PYZ-00.pyz
3756 INFO: Building PYZ (ZlibArchive) /Users/liyongjian/lyj/build/ServenDigitsDrawV2/PYZ-00.pyz completed successfully.
3760 INFO: checking PKG
3760 INFO: Building PKG because PKG-00.toc is non existent
3760 INFO: Building PKG (CArchive) PKG-00.pkg
6336 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
6339 INFO: Bootloader /Users/liyongjian/lyj/lyj_venv/lib/python3.7/site-packages/PyInstaller/bootloader/Darwin-64bit/runw
6339 INFO: checking EXE
6339 INFO: Building EXE because EXE-00.toc is non existent
6339 INFO: Building EXE from EXE-00.toc
6339 INFO: Appending archive to EXE /Users/liyongjian/lyj/dist/ServenDigitsDrawV2
6346 INFO: Fixing EXE for code signing /Users/liyongjian/lyj/dist/ServenDigitsDrawV2
6352 INFO: Building EXE from EXE-00.toc completed successfully.
6354 INFO: checking BUNDLE
6354 INFO: Building BUNDLE because BUNDLE-00.toc is non existent
6354 INFO: Building BUNDLE BUNDLE-00.toc
6366 INFO: moving BUNDLE data files to Resource directory

执行的时候报错

➜ liyongjiandeMBP.lan [/Users/liyongjian] /Users/liyongjian/lyj/dist/ServenDigitsDrawV2 ; exit;
Traceback (most recent call last):
File "PyInstaller/loader/rthooks/pyi_rth__tkinter.py", line 28, in <module>
FileNotFoundError: Tcl data directory "/var/folders/f9/6m090zhs6w55rmbmhkmpff440000gn/T/_MEITVlJln/tcl" not found.
[39503] Failed to execute script pyi_rth__tkinter[进程已完成]

解决办法:

在文件中增加

 and 'Python' not in path_to_tcl
PyInstaller/hooks/hook-_tkinter.py
@@ -180,7 +180,7 @@ def _find_tcl_tk(hook_api):
180
181   # _tkinter depends on Tcl/Tk compiled as frameworks.
182   path_to_tcl = bins[0][1]
    - if 'Library/Frameworks' in path_to_tcl:
183 + if 'Library/Frameworks' in path_to_tcl and 'Python' not in path_to_tcl:

参考链接:https://github.com/pyinstaller/pyinstaller/pull/3830
               https://stackoverflow.com/questions/51847801/pyinstaller-app-not-opening-on-mac

转载于:https://www.cnblogs.com/liyongjian5179/p/10683301.html

【解决】MacOS下 Python3.7 使用 pyinstaller 打包后执行报错 Failed to execute script pyi_rth__tkinter...相关推荐

  1. python3 打包后执行报错failed to execute script ***

    1.问题描述 使用pyinstaller -F ***.spec命令打包,打包过程无报错信息,生成可执行文件(.exe),双击运行报错,如下图: 2.查找原因 (1)百度,查看打包文件(build/* ...

  2. pyinstaller打包报错 Failed to execute script ‘xxx‘ due to unhandled exception:input():lost sys.stdin

    pyinstaller打包报错 Failed to execute script 'xxx' due to unhandled exception:input():lost sys.stdin pyi ...

  3. python-barcode 使用pyinstaller打包后运行报错cannot open resource

    python-barcode 使用pyinstaller打包后运行报错cannot open resource 问题描述: 使用pycharm可以正常生成条码,但是使用pyinstaller打包后,提 ...

  4. Pyinstaller 打包exe 报错 “failed to execute script XXX“的一种解决方案

    Pyinstaller 打包exe 报错 "failed to execute script XXX"的一种解决方案 参考文章: (1)Pyinstaller 打包exe 报错 & ...

  5. pyinstaller打包py文件生成的exe报错Failed to execute script

    版权声明:转载请注明作者(独孤尚良dugushangliang)出处:https://blog.csdn.net/dugushangliang/article/details/100761976 时常 ...

  6. Pyinstaller 打包exe 报错 failed to execute script XXX的一种解决方案

    最近用PyQt5写了一个界面小程序,需要打包成exe给到其他windows上使用,一开始使用python 3.7 64位,用pyinstaller打包exe,在64位机上运行正常. 但是目标电脑是32 ...

  7. python使用pyinstaller打包后运行报错排查思路

    程序使用win10 ,python39 编写 使用pyinstaller打包成exe 在本机运行正常在其他win7电脑运行报错 报错原因: python3.9 不支持win7系统 解决方案:使用pyt ...

  8. 【已解决】在react+ts中 atnd 用 upload 组件报错Failed to execute ‘readAsArrayBuffer,param 1 is notof type Blob

    今天在公司做 excel 导入文件的时候发现每次上传都会报这个错误: Uncaught TypeError: Failed to execute 'readAsArrayBuffer' on 'Fil ...

  9. pyinstaller 打包的exe在某些win7上面报错 faild to execute script pyi_rth_multiprocessing

    pyinstaller 打包的exe在某些win7上面报错 faild to execute script pyi_rth_multiprocessing  .一直没找到原因,一直以为是pyinsta ...

最新文章

  1. ScrollViewer滚动究竟来触发载入数据的Behavior
  2. 有关;;;的基础小节
  3. (4.7)mysql备份还原——深入解析二进制日志(3)binlog的三种日志记录模式详解...
  4. 如何使用Tmux提高终端环境下的效率
  5. NOIP模拟测试29「爬山·学数数·七十和十七」
  6. 简单说说驱动程序设计的入门
  7. visibility: hidden与display:none的区别
  8. VSCode 调试 Egg 完美版 - 进化史 #25
  9. JAVA设计模式之工厂模式(简单工厂模式+工厂方法模式)
  10. python字符串join和+_Python字符串通过'+'和join函数拼接新字符串的性能测试比较
  11. (一)在Lingo中使用集合
  12. bool类型头文件_C++ Primer Chapter2 变量和基本类型
  13. Spring Boot应用热启动的一种方式
  14. 实战i8一点通双服务器-------对比与虚拟盘完全分离(yang)
  15. excel编写计算机台账,[一键生成excel表格]excel表格生成台账的方法
  16. linuxcan之kvaser使用笔记
  17. 有关office2016图标显示异常的解决办法(亲测一天,终于解决!!!!)
  18. 电源管理IC的分类及智能变化
  19. Processing笔记04—鼠标键盘识别
  20. 服务器协议 重发 回包 039,3情报板预置播放表、位图一览表.doc

热门文章

  1. 被召者 RC: E_NOINTERFACE (0x80004002) 无法运行virtualBox的完善解决办法
  2. 解决ps打开图片错误:无法完成请求,找不到不知名或无效的JPEG标志符类型
  3. 如何部署服务器虚拟化,服务器如何虚拟化
  4. html怎么转换bmp,BMP是什么格式 怎么把BMP转成JPG格式的方法
  5. 【2021软件创新实验室暑假集训】SpringMVC框架(设计原理、简单使用、源码探究)
  6. LeetCode-105/106
  7. Mac 安装Homebrew方案
  8. Visual Studio 2013 - Visual Studio 2015 VA 百度网盘下载
  9. 泰克示波器上位机软件功能分享,这几款你都用过吗?
  10. PCB工艺设计规范-02