系列文章目錄
前言
項(xiàng)目地址:這兒
一、安裝
版本要求
Python: 3.7+
PyTorch: >=1.7.1
安裝:
pip install torch torchvision torchaudio
pip install "pix2tex[gui]
注意:Pyside6 和 PyQt6 版本需要保持一致,否則會(huì)報(bào) QT 錯(cuò)誤
二、使用
打開(kāi) Windows 終端,輸入命令:
latexocr
注意:需要將 latexocr.exe 所在路徑添加到系統(tǒng) Path 路徑下,以便找到該可執(zhí)行文件
例如:
三、
可以識(shí)別出來(lái),如果識(shí)別有錯(cuò)誤,可以直接在 gui 界面修改 Latex 代碼,公式會(huì)實(shí)時(shí)更新,修改好之后再?gòu)?fù)制。
四、報(bào)錯(cuò)
Traceback (most recent call last):
File "D:\Software\miniconda3\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Software\miniconda3\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\kuanli\AppData\Roaming\Python\Python310\Scripts\latexocr.exe\__main__.py", line 7, in <module>
File "C:\Users\kuanli\AppData\Roaming\Python\Python310\site-packages\pix2tex\__main__.py", line 28, in main
main(arguments)
File "C:\Users\kuanli\AppData\Roaming\Python\Python310\site-packages\pix2tex\gui.py", line 347, in main
ex = App(arguments)
File "C:\Users\kuanli\AppData\Roaming\Python\Python310\site-packages\pix2tex\gui.py", line 28, in __init__
self.model = cli.LatexOCR(self.args)
File "D:\Software\miniconda3\lib\contextlib.py", line 79, in inner
return func(*args, **kwds)
File "C:\Users\kuanli\AppData\Roaming\Python\Python310\site-packages\pix2tex\cli.py", line 84, in __init__
self.model.load_state_dict(torch.load(self.args.checkpoint, map_location=self.args.device))
File "C:\Users\kuanli\AppData\Roaming\Python\Python310\site-packages\torch\serialization.py", line 993, in load
with _open_zipfile_reader(opened_file) as opened_zipfile:
File "C:\Users\kuanli\AppData\Roaming\Python\Python310\site-packages\torch\serialization.py", line 447, in __init__
super().__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
因?yàn)橄螺d模型文件時(shí)網(wǎng)絡(luò)錯(cuò)誤,導(dǎo)致模型文件下載不全
路徑下:
C:\Users\kuanli\AppData\Roaming\Python\Python310\site-packages\pix2tex\model\checkpoints文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-742025.html
刪除未下載完的 .pth
文件,再次運(yùn)行即可文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-742025.html
到了這里,關(guān)于pix2tex - LaTeX OCR 安裝使用記錄的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!