Closed yansheng836 closed 1 week ago
好的,这就修改一下
numpy 应该是版本低了,可以重装一下
好像不是这个numpy版本低的问题,它当前已经是最新了
$ pip uninstall numpy
Found existing installation: numpy 2.1.3
Uninstalling numpy-2.1.3:
Would remove:
f:\python\python311\lib\site-packages\numpy-2.1.3-cp311-cp311-win_amd64.whl
f:\python\python311\lib\site-packages\numpy-2.1.3.dist-info\*
f:\python\python311\lib\site-packages\numpy.libs\libscipy_openblas64_-c16e4918366c6bc1f1cd71e28c
a36fc0.dll
f:\python\python311\lib\site-packages\numpy.libs\msvcp140-d64049c6e3865410a7dda6a7e9f0c575.dll
f:\python\python311\lib\site-packages\numpy\*
f:\python\python311\scripts\f2py.exe
f:\python\python311\scripts\numpy-config.exe
Proceed (Y/n)? y
Successfully uninstalled numpy-2.1.3
$ pip install numpy
Collecting numpy
Using cached numpy-2.1.3-cp311-cp311-win_amd64.whl (12.9 MB)
Installing collected packages: numpy
Successfully installed numpy-2.1.3
不知道了,可能你安装的 python 有问题吧,正常 numpy 引入 typing 不应该报错的
卸载干净,又重新安装了个3.12,用上了,感谢。
其实还有个问题,一开始报错,看了这个(https://github.com/Byaidu/PDFMathTranslate/issues/27)之后发现默认是用Google翻译的,fq之后就好了,有点好奇的是为啥这里提示连接问题,里面有个url,却不是google翻译那个呢?
$ pdf2zh confpgxc_final.pdf
Downloading...
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "F:\Python\Python312\Scripts\pdf2zh.exe\__main__.py", line 7, in <module>
File "F:\Python\Python312\Lib\site-packages\pdf2zh\pdf2zh.py", line 229, in main
extract_text(**vars(parsed_args))
File "F:\Python\Python312\Lib\site-packages\pdf2zh\pdf2zh.py", line 73, in extract_text
urllib.request.urlretrieve("http://huggingface.co/juliozhao/DocLayout-YOLO-DocStructBench/resolv
e/main/doclayout_yolo_docstructbench_imgsz1024.pt",pth)
File "F:\Python\Python312\Lib\urllib\request.py", line 240, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
^^^^^^^^^^^^^^^^^^
File "F:\Python\Python312\Lib\urllib\request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Python\Python312\Lib\urllib\request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "F:\Python\Python312\Lib\urllib\request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "F:\Python\Python312\Lib\urllib\request.py", line 559, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "F:\Python\Python312\Lib\urllib\request.py", line 639, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
这个链接是布局分析模型
1.Python版本问题
首先是这里只说了
Require Python version <=3.12
,但是实际上需要3.8以上,不然有依赖会报错:后面去包管理中心(https://pypi.org/project/pdf2zh/1.6.9/)看了下,这里确实有说明需要3.8以上。(因为没研究过,不知道pypi这里的说明是不是分开维护的,和github仓库这边的有些差异……)
之后换了,3.11,安装正常
2.pdf2zh命令报错OpenCV bindings requires "numpy" package:
提示没有numpy,但是实际上是有的,不确定是本地环境问题,还是依赖包直接有冲突?