QGIS使用pyinstaller时找不到pyconfig.h

测试脚本

import numpy as np


arr = np.array([1, 2, 3])

print(arr)

打包命令

"C:\Program Files\QGIS 3.10\bin\python-qgis-ltr.bat" -m PyInstaller -c test.py

错误详情

58 INFO: PyInstaller: 4.1
59 INFO: Python: 3.7.0
60 INFO: Platform: Windows-10-10.0.19041-SP0
64 INFO: wrote D:\workspace\test_numpy\test.spec
66 INFO: UPX is not available.
72 INFO: Extending PYTHONPATH with paths
['D:\\workspace\\test_numpy', 'D:\\workspace\\test_numpy']
177 INFO: checking Analysis
177 INFO: Building Analysis because Analysis-00.toc is non existent
178 INFO: Initializing module dependency graph...
184 INFO: Caching module graph hooks...
203 INFO: Analyzing base_library.zip ...
4018 INFO: Caching module dependency graph...
4095 INFO: running Analysis Analysis-00.toc
4098 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:\PROGRA~1\QGIS3~1.10\apps\Python37\python.exe
4151 INFO: Analyzing D:\workspace\test_numpy\test.py
4580 INFO: Processing pre-find module path hook distutils from 'C:\\PROGRA~1\\QGIS3~1.10\\apps\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
4581 INFO: distutils: retargeting to non-venv dir 'C:\\PROGRA~1\\QGIS3~1.10\\apps\\Python37\\lib'
5911 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from 'C:\\PROGRA~1\\QGIS3~1.10\\apps\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-setuptools.extern.six.moves.py'.
6371 INFO: Processing pre-find module path hook site from 'C:\\PROGRA~1\\QGIS3~1.10\\apps\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
6371 INFO: site: retargeting to fake-dir 'C:\\PROGRA~1\\QGIS3~1.10\\apps\\Python37\\lib\\site-packages\\PyInstaller\\fake-modules'
9024 INFO: Processing module hooks...
9025 INFO: Loading module hook 'hook-difflib.py' from 'C:\\PROGRA~1\\QGIS3~1.10\\apps\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
9031 INFO: Excluding import of doctest from module difflib
9031 INFO: Loading module hook 'hook-distutils.py' from 'C:\\PROGRA~1\\QGIS3~1.10\\apps\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
Unable to find "C:\PROGRA~1\QGIS3~1.10\apps\Python37\Include\pyconfig.h" when adding binary and data files.This would mean your Python installation doesn't
come with proper library files. This usually happens by missing development
package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
  * apt-get install python3-dev
  * apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with
`--enable-shared` (or, `--enable-framework` on Darwin)

错误分析

初步分析是缺少pyconfig.h导致,进入C:\Program Files\QGIS 3.10\apps\Python37\include果然发现只有sip.h一个文件,最后搜索电脑上哪里有pyconfig.h,最后在C:\Program Files\Python37\include中发现存在pyconfig.h,拷贝至C:\Program Files\QGIS 3.10\apps\Python37\include重新打包即可

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

llc的足迹

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值