使用GDAL库从python创建.exe文件

如何解决使用GDAL库从python创建.exe文件

我使用pyinstallerhttps://www.pyinstaller.org/)从python .py文件生成.exe文件。在我的项目中,我使用osgeo包(gdalogrosrproj)。这是用于python的带有“ glue”的二进制文件。我使用以下方法生成.exe文件:

pyinstaller --onefile main.py

为其记录:

pyinstaller --onefile main.py
58 INFO: PyInstaller: 4.0
58 INFO: Python: 3.8.5 (conda)
58 INFO: Platform: Windows-10-10.0.18362-SP0
58 INFO: wrote C:\Users\user\Documents\GitHub\project\test\main.spec
58 INFO: UPX is not available.
58 INFO: Extending PYTHONPATH with paths
['C:\\Users\\user\\Documents\\GitHub\\project\\test','C:\\Users\\user\\Documents\\GitHub\\project\\test']
74 INFO: checking Analysis
74 INFO: Building Analysis because Analysis-00.toc is non existent
74 INFO: Initializing module dependency graph...
74 INFO: Caching module graph hooks...
91 INFO: Analyzing base_library.zip ...
2121 INFO: Processing pre-find module path hook distutils from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2121 INFO: distutils: retargeting to non-venv dir 'c:\\users\\user\\anaconda3\\envs\\test\\lib'
5261 INFO: Caching module dependency graph...
5370 INFO: running Analysis Analysis-00.toc
5370 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\user\anaconda3\envs\test\python.exe
5667 INFO: Analyzing C:\Users\user\Documents\GitHub\project\test\main.py
5840 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.p
ackages.six.moves.py'.
8199 INFO: Processing pre-find module path hook site from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
8199 INFO: site: retargeting to fake-dir 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\fake-modules'
9298 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-setuptoo
ls.extern.six.moves.py'.
12121 INFO: Processing module hooks...
12121 INFO: Loading module hook 'hook-certifi.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
12121 INFO: Loading module hook 'hook-osgeo.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
12136 INFO: Loading module hook 'hook-distutils.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
12136 INFO: Loading module hook 'hook-encodings.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
12202 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
12246 INFO: Loading module hook 'hook-numpy.core.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
12417 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
12433 INFO: Loading module hook 'hook-numpy.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
12433 INFO: Loading module hook 'hook-pkg_resources.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
12699 INFO: Processing pre-safe import module hook win32com from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py
'.
Traceback (most recent call last):
  File "<string>",line 2,in <module>
ModuleNotFoundError: No module named 'win32com'
12746 INFO: Processing pre-safe import module hook win32com from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py
'.
Traceback (most recent call last):
  File "<string>",in <module>
ModuleNotFoundError: No module named 'win32com'
13152 WARNING: Hidden import "pkg_resources.py2_warn" not found!
13152 WARNING: Hidden import "pkg_resources.markers" not found!
13152 INFO: Excluding import '__main__'
13152 INFO:   Removing import of __main__ from module pkg_resources
13152 INFO: Loading module hook 'hook-setuptools.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
13730 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
13730 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
13730 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
13730 INFO: Loading module hook 'hook-xml.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
13730 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks'...
13871 INFO: checking Tree
13871 INFO: Building Tree because Tree-00.toc is non existent
13871 INFO: Building Tree Tree-00.toc
13949 INFO: checking Tree
13949 INFO: Building Tree because Tree-01.toc is non existent
13949 INFO: Building Tree Tree-01.toc
14011 INFO: Looking for ctypes DLLs
14089 INFO: Analyzing run-time hooks ...
14105 INFO: Including run-time hook 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth__tkinter.py'
14105 INFO: Including run-time hook 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
14105 INFO: Including run-time hook 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
14105 INFO: Including run-time hook 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_osgeo.py'
14105 INFO: Including run-time hook 'c:\\users\\user\\anaconda3\\envs\\test\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_certifi.py'
14121 INFO: Looking for dynamic libraries
14136 WARNING: lib not found: msmpi.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_blacs_msmpi_lp64.dll
14321 WARNING: lib not found: mpich2mpi.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_blacs_mpich2_ilp64.dll
14417 WARNING: lib not found: msmpi.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_blacs_msmpi_ilp64.dll
14417 WARNING: lib not found: impi.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_blacs_intelmpi_ilp64.dll
14511 WARNING: lib not found: pgc14.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_pgi_thread.dll
14511 WARNING: lib not found: pgf90.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_pgi_thread.dll
14511 WARNING: lib not found: pgf90rtl.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_pgi_thread.dll
14621 WARNING: lib not found: mpich2mpi.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_blacs_mpich2_lp64.dll
14705 WARNING: lib not found: impi.dll dependency of c:\users\user\anaconda3\envs\test\Library\bin\mkl_blacs_intelmpi_lp64.dll
15730 INFO: Looking for eggs
15730 INFO: Using Python library c:\users\user\anaconda3\envs\test\python38.dll
15746 INFO: Found binding redirects:
[]
15746 INFO: Warnings written to C:\Users\user\Documents\GitHub\project\test\build\main\warn-main.txt
15870 INFO: Graph cross-reference written to C:\Users\user\Documents\GitHub\project\test\build\main\xref-main.html
15933 INFO: checking PYZ
15933 INFO: Building PYZ because PYZ-00.toc is non existent
15933 INFO: Building PYZ (ZlibArchive) C:\Users\user\Documents\GitHub\project\test\build\main\PYZ-00.pyz
17181 INFO: Building PYZ (ZlibArchive) C:\Users\user\Documents\GitHub\project\test\build\main\PYZ-00.pyz completed successfully.
17199 INFO: checking PKG
17199 INFO: Building PKG because PKG-00.toc is non existent
17199 INFO: Building PKG (CArchive) PKG-00.pkg
90857 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
90889 INFO: Bootloader c:\users\user\anaconda3\envs\test\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
90889 INFO: checking EXE
90889 INFO: Building EXE because EXE-00.toc is non existent
90889 INFO: Building EXE from EXE-00.toc
90889 INFO: Appending archive to EXE C:\Users\user\Documents\GitHub\project\test\dist\main.exe
91621 INFO: Building EXE from EXE-00.toc completed successfully.

运行此.exe文件后,我警告缺少proj.db文件。

警告消息:ERROR 1: PROJ: proj_identify: Cannot find proj.db

我尝试使用(https://pyinstaller.readthedocs.io/en/stable/usage.html#what-to-bundle-where-to-search)添加此文件: --add-data('proj.db:.'),但不起作用

怎么可能

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 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时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;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,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;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[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 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 -&gt; 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(&quot;/hires&quot;) 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&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-