Pyinstaller pyenv M1 加载 Python 库时出错

如何解决Pyinstaller pyenv M1 加载 Python 库时出错

加载 Python 库时出错

这是我执行 dist/app 文件时的错误信息。我正在使用 python 3.9.1 形式的 pyenv。脚本在 pyinstaller 文件之外工作正常。

我确实设法在 Windows 上制作了可执行文件,但我连续第二天在 macOS 上苦苦挣扎,没有找到任何解决方案。

我也试过用 python 3.9.5 这样做,但也没有用

[5359] Error loading Python lib '/var/folders/vk/s_2bhqxd1c92mj0_n117rs0w0000gn/T/_MEIktOUOi/Python': dlopen: dlopen(/var/folders/vk/s_2bhqxd1c92mj0_n117rs0w0000gn/T/_MEIktOUOi/Python,10): no suitable image found.  Did find:
    /var/folders/vk/s_2bhqxd1c92mj0_n117rs0w0000gn/T/_MEIktOUOi/Python: mach-o,but wrong architecture
    /var/folders/vk/s_2bhqxd1c92mj0_n117rs0w0000gn/T/_MEIktOUOi/Python: stat() failed with errno=1
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

Mac 操作系统版本
macOS Big Sur 11.2.3 M1 芯片组

build.spec

gooey_root = os.path.dirname(gooey.__file__)
gooey_languages = Tree(os.path.join(gooey_root,'languages'),prefix = 'gooey/languages')
gooey_images = Tree(os.path.join(gooey_root,'images'),prefix = 'gooey/images')

from PyInstaller.utils.hooks import copy_metadata,collect_data_files

a = Analysis(['admin_creator.py'],pathex=["/Users/dominikbak/.pyenv/shims/python"],hiddenimports=[],hookspath=None,datas = copy_metadata("pycountry") + collect_data_files("pycountry"),runtime_hooks=None,)
pyz = PYZ(a.pure)

options = [('u',None,'OPTION'),('u','OPTION')]

exe = EXE(pyz,a.scripts,a.binaries,a.zipfiles,a.datas,options,gooey_languages,# Add them in to collected files
          gooey_images,# Same here.
          name='Admin Creator',debug=False,strip=None,upx=False,console=False,windowed=True,icon=os.path.join(gooey_root,'images','program_icon.ico'))

我在执行 pyinstaller build.spec 后得到的消息

31 INFO: Python: 3.9.1
39 INFO: Platform: macOS-11.2.3-arm64-arm-64bit
40 INFO: UPX is not available.
45 INFO: checking Tree
46 INFO: Building because root changed
46 INFO: Building Tree Tree-00.toc
47 INFO: checking Tree
47 INFO: Building because root changed
47 INFO: Building Tree Tree-01.toc
151 INFO: Extending PYTHONPATH with paths
['/Users/dominikbak/Miinto/AdminCreator','/Users/dominikbak/.pyenv/shims/python']
156 INFO: checking Analysis
165 INFO: Building because hookspath changed
165 INFO: Initializing module dependency graph...
165 INFO: Caching module graph hooks...
167 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
168 INFO: Analyzing base_library.zip ...
1257 INFO: Processing pre-find module path hook distutils from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/pre_find_module_path/hook-distutils.py'.
1257 INFO: distutils: retargeting to non-venv dir '/Users/dominikbak/.pyenv/versions/3.9.1/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9'
2616 INFO: Caching module dependency graph...
2676 INFO: running Analysis Analysis-00.toc
2679 INFO: Analyzing admin_creator.py
2987 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-setuptools.extern.six.moves.py'.
3126 INFO: Processing pre-find module path hook site from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/pre_find_module_path/hook-site.py'.
3126 INFO: site: retargeting to fake-dir '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/fake-modules'
5007 INFO: Processing pre-safe import module hook six.moves from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-six.moves.py'.
6331 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-urllib3.packages.six.moves.py'.
/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/selenium/webdriver/firefox/firefox_profile.py:208: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if setting is None or setting is '':
7617 INFO: Processing module hooks...
7617 INFO: Loading module hook 'hook-selenium.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
7633 INFO: Loading module hook 'hook-gooey.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
7663 INFO: Loading module hook 'hook-sqlite3.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
7690 INFO: Loading module hook 'hook-pkg_resources.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
7863 INFO: Processing pre-safe import module hook win32com from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/pre_safe_import_module/hook-win32com.py'.
7864 WARNING: Hidden import "pkg_resources.py2_warn" not found!
7864 WARNING: Hidden import "pkg_resources.markers" not found!
7865 INFO: Loading module hook 'hook-pandas.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8223 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8224 INFO: Loading module hook 'hook-pytz.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8254 INFO: Loading module hook 'hook-lib2to3.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8269 INFO: Loading module hook 'hook-_tkinter.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8272 INFO: Not collecting Tcl/Tk data - either python is using macOS' system Tcl/Tk framework,or Tcl/Tk data directories could not be found.
8272 INFO: Loading module hook 'hook-encodings.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8300 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8303 INFO: Loading module hook 'hook-distutils.util.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8304 INFO: Loading module hook 'hook-PIL.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8305 INFO: Import to be excluded not found: 'FixTk'
8307 INFO: Loading module hook 'hook-setuptools.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
8531 INFO: Loading module hook 'hook-xml.dom.domreg.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8532 INFO: Loading module hook 'hook-PIL.Image.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8686 INFO: Loading module hook 'hook-pickle.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8688 INFO: Loading module hook 'hook-heapq.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8689 INFO: Loading module hook 'hook-difflib.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8691 INFO: Loading module hook 'hook-multiprocessing.util.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8692 INFO: Loading module hook 'hook-sysconfig.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8696 INFO: Loading module hook 'hook-xml.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8696 INFO: Loading module hook 'hook-numpy.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8717 INFO: Import to be excluded not found: 'f2py'
8721 INFO: Loading module hook 'hook-distutils.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8721 INFO: Loading module hook 'hook-numpy._pytesttester.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8723 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8723 INFO: Import to be excluded not found: 'FixTk'
8724 INFO: Loading module hook 'hook-setuptools.msvc.py' from '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks'...
8748 INFO: Looking for ctypes DLLs
8782 WARNING: library user32 required via ctypes not found
8784 WARNING: library msvcrt required via ctypes not found
8795 INFO: Analyzing run-time hooks ...
8798 INFO: Including run-time hook '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py'
8801 INFO: Including run-time hook '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth__tkinter.py'
8801 INFO: Including run-time hook '/Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgres.py'
8810 INFO: Looking for dynamic libraries
8926 INFO: Looking for eggs
8926 INFO: Using Python library /Users/dominikbak/.pyenv/versions/3.9.1/Library/Frameworks/Python.framework/Versions/3.9/Python
8931 INFO: Warnings written to /Users/dominikbak/Miinto/AdminCreator/build/build/warn-build.txt
8968 INFO: Graph cross-reference written to /Users/dominikbak/Miinto/AdminCreator/build/build/xref-build.html
8988 INFO: Appending 'datas' from .spec
9002 INFO: checking PYZ
9008 INFO: Building because toc changed
9008 INFO: Building PYZ (ZlibArchive) /Users/dominikbak/Miinto/AdminCreator/build/build/PYZ-00.pyz
9670 INFO: Building PYZ (ZlibArchive) /Users/dominikbak/Miinto/AdminCreator/build/build/PYZ-00.pyz completed successfully.
9683 INFO: checking PKG
9691 INFO: Building because toc changed
9691 INFO: Building PKG (CArchive) PKG-00.pkg
20526 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
20545 INFO: Bootloader /Users/dominikbak/.pyenv/versions/3.9.1/envs/env/lib/python3.9/site-packages/PyInstaller/bootloader/Darwin-64bit-arm/runw
20545 INFO: checking EXE
20553 INFO: Building because icon changed
20553 INFO: Building EXE from EXE-00.toc
20553 INFO: Appending archive to EXE /Users/dominikbak/Miinto/AdminCreator/dist/Admin Creator
20580 INFO: Fixing EXE for code signing /Users/dominikbak/Miinto/AdminCreator/dist/Admin Creator
20581 INFO: Building EXE from EXE-00.toc completed successfully.```

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-