因為要使用 PaddleOCR,需要安裝依賴。先通過 conda新建了虛擬環境,然后安裝 PaddlePaddle,繼續安裝 PaddleOCR,上述過程我是在 VSCode的終端中處理,結果報錯如下:
Downloading multidict-6.6.3-cp312-cp312-win_amd64.whl.metadata (5.4 kB)WARNING: Connection timed out while downloading.
ERROR: Could not install packages due to an OSError: [WinError 32] 另一個程序正在使用此文件,進程無法訪問。: 'C:\\Users\\xxx\\AppData\\Local\\Temp\\pip-unpack-736fbb1e\\multidict-6.6.3-cp312-cp312-win_amd64.whl.metadata'
Consider using the `--user` option or check the permissions.
各種上網搜索解決方案,大致如下:
# 清理
pip cache purge
# 添加 user no-cache-dir 等參數安裝
pip install --user --no-cache-dir paddleocr
還有一些建議,要關閉VSCode,在任務管理器中找到進程kill,更有一些建議是系統重啟等,據說有效,但對我的情況,依然是報錯:
Collecting paddleocrWARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/d9/7f/2ea116c5d1a576786280ee3fa06388cd5bdcd274deafb10064dfa2d6f4c4/paddleocr-3.1.0-py3-none-any.whl.metadata
......
......
ERROR: Could not install packages due to an OSError: [WinError 32] 另一個程序正在使用此文件,進程無法訪問。: 'C:\\Users\\xxx\\AppData\\Local\\Temp\\pip-unpack-se2grp_h\\huggingface_hub-0.33.2-py3-none-any.whl.metadata'
Check the permissions.
我發現前面有警告 timed out,感覺這是網絡的問題,會不會是需要VPN?
嘗試打開VPN,重新安裝,非常順利,一路ok。
問題就是這樣莫名解決了。
建議有類似情況的,可以先打開VPN試試。