测试-小白 2023-03-28 17:19 采纳率: 66.7%
浏览 159

Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

我尝试用pyinsatller打包项目文件,打包完成后运行exe文件提示我Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

下面是部分代码,打包过程中也没有发现报错

PS D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1> pyinstaller -D startup.py
509 INFO: PyInstaller: 5.9.0
509 INFO: Python: 3.8.10
3613 INFO: Platform: Windows-10-10.0.19044-SP0
3614 INFO: wrote D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1\startup.spec
3620 INFO: UPX is not available.
3623 INFO: Extending PYTHONPATH with paths
['D:\\PycharmProjects\\PC_Tool\\Liuma-agent-1.1.1']
4133 INFO: checking Analysis
4134 INFO: Building Analysis because Analysis-00.toc is non existent
4134 INFO: Initializing module dependency graph...
4139 INFO: Caching module graph hooks...
4157 INFO: Analyzing base_library.zip ...
5704 INFO: Loading module hook 'hook-heapq.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5899 INFO: Loading module hook 'hook-encodings.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
6927 INFO: Loading module hook 'hook-pickle.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
7703 INFO: Caching module dependency graph...
7798 INFO: running Analysis Analysis-00.toc
7803 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by d:\python\python.exe
7981 INFO: Analyzing D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1\startup.py
8032 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
8230 INFO: Loading module hook 'hook-xml.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
8782 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'.
9641 INFO: Loading module hook 'hook-certifi.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
10429 INFO: Loading module hook 'hook-difflib.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
10597 INFO: Loading module hook 'hook-platform.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
10612 INFO: Loading module hook 'hook-sysconfig.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
11404 INFO: Loading module hook 'hook-pkg_resources.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
12871 INFO: Loading module hook 'hook-PIL.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
12913 INFO: Loading module hook 'hook-PIL.Image.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
13605 INFO: Loading module hook 'hook-packaging.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
13643 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
14127 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
14343 INFO: Loading module hook 'hook-adbutils.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
14726 INFO: Processing pre-safe import module hook six.moves from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-six.moves.py'.
14932 INFO: Loading module hook 'hook-lxml.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
15696 INFO: Processing module hooks...
15696 INFO: Loading module hook 'hook-lxml.etree.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
15980 INFO: Loading module hook 'hook-lxml.isoschematron.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
16139 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
16207 INFO: Processing pre-safe import module hook win32com from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
16346 INFO: Loading module hook 'hook-win32com.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
16350 INFO: Loading module hook 'hook-pythoncom.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
16752 INFO: Loading module hook 'hook-pywintypes.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
17318 INFO: Processing pre-find module path hook distutils from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
17351 INFO: Loading module hook 'hook-distutils.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
17361 INFO: Loading module hook 'hook-distutils.util.py' from 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
17709 INFO: Loading module hook 'hook-lxml.objectify.py' from 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
18022 INFO: Looking for ctypes DLLs
18046 INFO: Analyzing run-time hooks ...
18051 INFO: Including run-time hook 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py'
18054 INFO: Including run-time hook 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
18057 INFO: Including run-time hook 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
18061 INFO: Including run-time hook 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_win32comgenpy.py'
18064 INFO: Including run-time hook 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_pywintypes.py'
18065 INFO: Including run-time hook 'd:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_pythoncom.py'
18066 INFO: Including run-time hook 'd:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
18077 INFO: Looking for dynamic libraries
840 INFO: Extra DLL search directories (AddDllDirectory): []
840 INFO: Extra DLL search directories (PATH): ['C:\\Program Files\\VanDyke Software\\Clients\\', 'C:\\WINDOWS\\system32', 'C:\\WINDOWS', 'C:\\WINDOWS\\System32\\Wbem', 'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\', 'C:\\WIND
OWS\\System32\\OpenSSH\\', 'C:\\jdk1.8.0_191\\bin', 'C:\\allure-2.18.1\\bin', 'C:\\Program Files\\TortoiseSVN\\bin', 'D:\\xshell\\', 'D:\\自动化测试\\allure\\bin', 'D:\\自动化测试\\allure\\lib', 'C:\\ProgramData\\chocolatey\\bin',
 'D:\\android-sdk-windows\\platform-tools', 'D:\\android-sdk-windows\\tools', 'D:\\Program Files\\nodejs\\', 'D:\\Python', 'D:\\Python\\Scripts', 'C:\\Users\\admin\\AppData\\Local\\Microsoft\\WindowsApps', 'C:\\Program Files\\JetB
rains\\PyCharm Community Edition 2022.2\\bin', 'D:\\Users\\admin\\AppData\\Local\\Programs\\Fiddler', 'C:\\Users\\admin\\AppData\\Roaming\\npm', 'D:\\IntelliJ\\IntelliJ IDEA 2022.2.3\\bin', 'D:\\Pycharm\\PyCharm Community Edition 
2022.3.3\\bin', 'D:\\PycharmProjects\\PC_Tool\\Liuma-agent-1.1.1\\node_modules\\.bin']
19996 INFO: Looking for eggs
19996 INFO: Using Python library d:\python\python38.dll
19996 INFO: Found binding redirects:
[]
20002 INFO: Warnings written to D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1\build\startup\warn-startup.txt
20066 INFO: Graph cross-reference written to D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1\build\startup\xref-startup.html
20105 INFO: checking PYZ
20105 INFO: Building PYZ because PYZ-00.toc is non existent
20105 INFO: Building PYZ (ZlibArchive) D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1\build\startup\PYZ-00.pyz
20772 INFO: Building PYZ (ZlibArchive) D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1\build\startup\PYZ-00.pyz completed successfully.
20782 INFO: checking PKG
20783 INFO: Building PKG because PKG-00.toc is non existent
20783 INFO: Building PKG (CArchive) startup.pkg
20857 INFO: Writing RT_ICON 6 resource with 4264 bytes
20857 INFO: Writing RT_ICON 7 resource with 1128 bytes
20861 INFO: Copying 0 resources to EXE
20861 INFO: Embedding manifest in EXE
20862 INFO: Updating manifest in D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1\build\startup\startup.exe.notanexecutable
20863 INFO: Updating resource type 24 name 1 language 0
20866 INFO: Appending PKG archive to EXE
20872 INFO: Fixing EXE headers
20932 INFO: Building EXE from EXE-00.toc completed successfully.
20935 INFO: checking COLLECT
20935 INFO: Building COLLECT because COLLECT-00.toc is non existent
20936 INFO: Building COLLECT COLLECT-00.toc
21752 INFO: Building COLLECT COLLECT-00.toc completed successfully.
PS D:\PycharmProjects\PC_Tool\Liuma-agent-1.1.1>

因为直接打开exe会闪退,所以我选择用cmd运行

img


看网上说可能是PYTHONHOME和PYTHONPATH环境变量没有配置好,我重新配置了N次然后又重启电脑还是不行,脑袋都想破了都想不出哪里出了问题
下面是环境变量的配置

img

img

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-03-28 20:05
    关注
    评论

报告相同问题?

问题事件

  • 修改了问题 3月28日
  • 创建了问题 3月28日

悬赏问题

  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址