Python使用pyinstaller打包exe文件报错
Python使用pyinstaller打包exe文件遇到了写问题,卸载部分包重装即可。注意,py 3.7需要pyinstaller==3.4以上版本。
cmd
pip uninstall enum34
pip install pywin32
pip install pyinstaller==3.4 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pyinstaller -p D:\Anaconda\Lib\site-packages -F ServiceForDocSim.py
pyinstaller -D --distpath D:\Detect_Maintain_exe –p C:\Users\Administrator\anaconda3\Lib\site-packages DocSimDetect.py
pyinstaller -D --distpath “exe文件夹保存的路径” –p C:\Users\Administrator\anaconda3\Lib\site-packages(这是py所有第三方库,使用这个参数可以自动搜索项目相关的库)
使用C#写DLL时引用Microsoft.Office.Interop.Word.dll
在普通用户权限下运行会报错
检索 COM 类工厂中 CLSID 为 {000209FF-0000-0000-C000-000000000046} 的组件失败,原因是出现以下错误: 80070005 拒绝访问。
解决方案:
重新安装office 2013(可选)
CMD comexp.msc -32 打开组件服务
依次展开"组件服务"->"计算机"->"我的电脑"->"DCOM配置"->"Microsoft Word 文档"
右键打开“属性”对话框,点击“标识”选项卡,选择交互式用户;
点击“安全”选项卡,“启动和激活权限”、“访问权限”选择自定义
编辑启动和激活权限权限的自定义选项,将everyone用户添加进去,给与本地激活和远程激活的权限,访问权限相同
将exe注册为win10服务
将要注册的exe放在nssm.exe相同目录下
先cd到nssm.exe目录
Cmd
nssm install ServiceForDocSim
path选择ServiceForDocSim.exe 点ok
任务管理器-服务-打开服务-ServiceForDocSim-登录-勾选允许服务与桌面交互-应用
任务管理器-服务-打开服务-ServiceForDocSim-自动-启动
卸载服务:nssm remove ServiceForDocSim
NSSM 下载地址: http://www.nssm.cc/release/nssm-2.24.zip