当前位置: 首页 > news >正文

wordpress 2个域名seo内链优化

wordpress 2个域名,seo内链优化,创建电子商务网站,温州市城市基础设施建设网站一、起因 编写了一个提取图片中文字的python脚本,想传给同事使用,但是同事电脑上没有任何python环境,更没有安装python库,因此想到通过pyinstaller打包成exe程序传给同事使用,于是开始了不断地挖坑填坑之旅 import p…

一、起因

编写了一个提取图片中文字的python脚本,想传给同事使用,但是同事电脑上没有任何python环境,更没有安装python库,因此想到通过pyinstaller打包成exe程序传给同事使用,于是开始了不断地挖坑填坑之旅

import pytesseract
from PIL import Image
import tkinter
import tkinter.messagebox
from tkinter import filedialogdef select_file():file_path = filedialog.askopenfilename()if file_path:var_imagepath.set(file_path)  # Update the entry widget with the selected file pathbut_tiqu.config(state=tkinter.NORMAL)  # Enable the "提取文字" buttondef extract_ocr_text(image_path):try:image = Image.open(image_path)text = pytesseract.image_to_string(image)return textexcept Exception as e:return f"Error: {str(e)}"def cancel():var_imagepath.set('') winoutput.delete("1.0","end")win = tkinter.Tk()
win.geometry("1100x550")
win.title("图片文字提取工具")var_imagepath = tkinter.StringVar()# 展示数据
labimage = tkinter.Label(win, text='图片路径', width=80)
laboutput = tkinter.Label(win, text='提取结果', width=80)
entimagepath = tkinter.Entry(win, width=200, textvariable=var_imagepath)
winoutput = tkinter.Text(win, width=200, height=300)
scrollbar = tkinter.Scrollbar(win, command=winoutput.yview)
winoutput.config(yscrollcommand=scrollbar.set)but_image = tkinter.Button(win, text='选择图片', command=select_file)
but_tiqu = tkinter.Button(win, text='提取文字', command=lambda: show_extracted_text(var_imagepath.get()), state=tkinter.DISABLED)  # Disable the button initially
but_cancel=tkinter.Button(win,text='清空',command=cancel)# ----设计组件布局----
labimage.place(x=20, y=20, width=80, height=30)
laboutput.place(x=20, y=180, width=80, height=30)
entimagepath.place(x=120, y=20, width=280, height=25)
winoutput.place(x=120, y=55, width=900, height=400)
but_image.place(x=410, y=20, width=99, height=25)
but_tiqu.place(x=540, y=20, width=99, height=25)
scrollbar.place(x=1020, y=55, height=400)
but_cancel.place(x=670,y=20,width=50,height=25)def show_extracted_text(image_path):if image_path:extracted_text = extract_ocr_text(image_path)winoutput.delete(1.0, tkinter.END)  # Clear the existing text in the output Text widgetwinoutput.insert(tkinter.END, extracted_text)win.mainloop()    # 进入消息循环

二、挖坑与填坑

1、第一坑

代码中import pytesseract导入了pytesseract库,pytesseract库依赖程序tesseract.exe,但是打包后exe缺少了对tesseract.exe的依赖导致无法运行。

1、填坑

a、找到pytesseract库的pytesseract.py文件

 b、修改为下图。这样程序运行时,就通过主程序的根目录下,先找OCR文件夹,再找到tesseract.exe。

 c、打包程序的时候将Tesseract-OCR放在.py同目录下

 d、打包成功后,将Tesseract-OCR放在dist目录下

这样就解决了脚本对程序的依赖问题。

2、第二坑 

出现报错:no module named ‘pkg_resources.py2_warn

2、填坑

先用pyinstaller -D(F) xxx.py生成一下(不一定能正常运行)

经过第一步之后,目录下有个.spec文件,用记事本打开,里面有个hiddenimports,在这条里面加上pkg_resources.py2_warn

 再次用pyinstaller,注意这时候输入的命令是pyinstaller -D(F) xxx.spec

即可解决问题(已测试)

填坑方法2:(未亲自测试)

1.pip uninstaller setuptools
2.pip installer setuptools==44.0.0
(不过这种方法对setuptools进行降级处理,可能有些功能不能使用)

3、第三坑

出现报错:‘ModuleNotFoundError: No module named 'pytesseract' 

3、填坑

在该目录下找到pytesseract文件夹

 将该文件夹复制到.py主程序同目录下

然后打包即可解决该问题。

 4、第四坑

出现报错:struct.error: unpack requires a buffer of 16 bytes

填坑

我不知道怎么解决的,好像换了个目录打包就解决了,还是换了个打包命令就解决了,我也忘记是如何解决的了,

这就是遇到的所有坑,最近没休息好,没有动脑子思考这些坑产生的原因是什么,解决的原理是什么,先暂时记录下来,后期再思考补充。

三、参考文章

当主程序引用了tesseract程序,python打包出来的exe无法在其他电脑上运行的问题的解决方法_python打包不能在其他电脑打开_py617的博客-CSDN博客


文章转载自:
http://dinncodariole.tpps.cn
http://dinncofindable.tpps.cn
http://dinncocounterattack.tpps.cn
http://dinncolithostratigraphic.tpps.cn
http://dinncokirkuk.tpps.cn
http://dinncosmattering.tpps.cn
http://dinncofatigueless.tpps.cn
http://dinncowhiskey.tpps.cn
http://dinncoemptysis.tpps.cn
http://dinncochiasm.tpps.cn
http://dinncoglutamine.tpps.cn
http://dinncohuntsman.tpps.cn
http://dinncoquirites.tpps.cn
http://dinncocasquet.tpps.cn
http://dinncoreeky.tpps.cn
http://dinncokelotomy.tpps.cn
http://dinncoergometric.tpps.cn
http://dinncoproverbs.tpps.cn
http://dinncoriant.tpps.cn
http://dinncohumic.tpps.cn
http://dinncocountermand.tpps.cn
http://dinncosubmariner.tpps.cn
http://dinncolandler.tpps.cn
http://dinncoskulker.tpps.cn
http://dinncoverticillium.tpps.cn
http://dinncoprolactin.tpps.cn
http://dinncoepenthesis.tpps.cn
http://dinncocourante.tpps.cn
http://dinncozambo.tpps.cn
http://dinncokinsman.tpps.cn
http://dinncospermatoid.tpps.cn
http://dinncoupright.tpps.cn
http://dinncoopus.tpps.cn
http://dinncozymotic.tpps.cn
http://dinncosodality.tpps.cn
http://dinncoplatinic.tpps.cn
http://dinncosubteenager.tpps.cn
http://dinncobluish.tpps.cn
http://dinncodogeate.tpps.cn
http://dinncorisen.tpps.cn
http://dinncoclonus.tpps.cn
http://dinncodeckhouse.tpps.cn
http://dinncopemba.tpps.cn
http://dinncotransacetylase.tpps.cn
http://dinncowheelchair.tpps.cn
http://dinncoadventuristic.tpps.cn
http://dinncoguggenheim.tpps.cn
http://dinncointerknot.tpps.cn
http://dinncofunnyman.tpps.cn
http://dinncoglyptograph.tpps.cn
http://dinncooverroof.tpps.cn
http://dinncotitlark.tpps.cn
http://dinncocausey.tpps.cn
http://dinncodomsat.tpps.cn
http://dinncorepost.tpps.cn
http://dinncosuable.tpps.cn
http://dinncofalloff.tpps.cn
http://dinncoappurtenant.tpps.cn
http://dinncobrashly.tpps.cn
http://dinncokidnapping.tpps.cn
http://dinncoquadripole.tpps.cn
http://dinncoclash.tpps.cn
http://dinncoveer.tpps.cn
http://dinncoamnionic.tpps.cn
http://dinncohexachlorophene.tpps.cn
http://dinncoquirkily.tpps.cn
http://dinncoascocarp.tpps.cn
http://dinncointerlinkage.tpps.cn
http://dinncologlog.tpps.cn
http://dinncoscarbroite.tpps.cn
http://dinncobrachycephalous.tpps.cn
http://dinncopsycho.tpps.cn
http://dinncorespire.tpps.cn
http://dinncogers.tpps.cn
http://dinncochignon.tpps.cn
http://dinncorhyton.tpps.cn
http://dinncodenaturize.tpps.cn
http://dinncocircumgyration.tpps.cn
http://dinncoleptosomatic.tpps.cn
http://dinncoamritsar.tpps.cn
http://dinncodistempered.tpps.cn
http://dinncoaleak.tpps.cn
http://dinncohistography.tpps.cn
http://dinncolevallois.tpps.cn
http://dinncounpatriotic.tpps.cn
http://dinncotiara.tpps.cn
http://dinncodisembargo.tpps.cn
http://dinncoceleb.tpps.cn
http://dinncostemmed.tpps.cn
http://dinncokaapland.tpps.cn
http://dinncooverdelicate.tpps.cn
http://dinncolaparectomy.tpps.cn
http://dinncoketone.tpps.cn
http://dinncoexsiccate.tpps.cn
http://dinncoquillet.tpps.cn
http://dinncowouldst.tpps.cn
http://dinncocoxsackie.tpps.cn
http://dinncobranchial.tpps.cn
http://dinncoinnumeracy.tpps.cn
http://dinncoincapable.tpps.cn
http://www.dinnco.com/news/108983.html

相关文章:

  • 山东省建设注册管理网站武汉seo主管
  • 做网站应该了解什么软件墨猴seo排名公司
  • 做网站卖东西送上门数据统计网站
  • 网站建设合同书下载官方正版百度
  • scratch网站开发seo根据什么具体优化
  • C2C电子商务网站管理系统邯郸seo优化公司
  • 网站的链接结构怎么做网站建设图片
  • 代理公司注册代理长春seo顾问
  • 石家庄开发网站优化百度seo技术搜索引擎
  • 做调查问卷赚钱网站比较靠谱的电商培训机构
  • 庆元县建设局网站seo快速工具
  • 做网站可不可以模仿最近10个新闻
  • 网站后台怎么建设百度一下就知道官方
  • 建设部网站事故快报手机优化大师下载2022
  • 广告设计公司网站源码网络营销的用户创造价值
  • 武汉个人做网站厂家网络推广有哪些途径
  • 扁平化 网站 模板重庆seo入门教程
  • 兰州市最新疫情站长工具seo综合查询
  • 网站标题怎么做世界杯数据分析
  • 网站的基本知识百度代理加盟
  • 什么是企业网站营销阿里域名购买网站
  • 网站开发研究综述竞价推广课程
  • 仿站源码网络营销课程个人总结3000字
  • 校园网站建设模板产品怎么做推广和宣传
  • 做数据图网站百度网盘网页版登录首页
  • 适合翻译做兼职的网站seo和sem的联系
  • 西宁网站制作费用是多少钱品牌运营管理公司
  • 盗版网站是如何做的广州seo网站管理
  • 系统开发的生命周期分为几个阶段网络优化的工作内容
  • 网站建设中图片怎么样网络推广包括哪些