参考nvm的一个issue:https://github.com/nvm-sh/nvm/issues/3363

异常信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

$ nvm install 22
Downloading and installing node v22.19.0...
Downloading https://nodejs.org/dist/v22.19.0/node-v22.19.0-linux-x64.tar.xz...
-#O=# # # Warning: Failed to open the file /home/zhangjc/.nvm/.cache/bin/node-v22.19.0-linux-x64/node-v22.19.0-linux-x64.tar.xz: Permission denied
curl: (23) client returned ERROR on write of 1360 bytes

download from https://nodejs.org/dist/v22.19.0/node-v22.19.0-linux-x64.tar.xz failed
grep: /home/zhangjc/.nvm/.cache/bin/node-v22.19.0-linux-x64/node-v22.19.0-linux-x64.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.
Binary download failed, trying source.
Downloading https://nodejs.org/dist/v22.19.0/node-v22.19.0.tar.xz...
-=#=- # # # Warning: Failed to open the file /home/zhangjc/.nvm/.cache/src/node-v22.19.0/node-v22.19.0.tar.xz: Permission denied
curl: (23) client returned ERROR on write of 1360 bytes

download from https://nodejs.org/dist/v22.19.0/node-v22.19.0.tar.xz failed
grep: /home/zhangjc/.nvm/.cache/src/node-v22.19.0/node-v22.19.0.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.
阅读全文 »

为了避免 /etc/sudoers 配置文件内容过多,可以在 /etc/sudoers.d 目录下新建配置文件。以我的用户名 zhangjc 为例:

1
$ sudo vi /etc/sudoers.d/zhangjc

输入以下内容:

阅读全文 »

安装 Tesseract 及 PyTesseract 后,在验证时,出现以下异常信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Traceback (most recent call last):
File "/home/zhangjc/Downloads/pyocr.py", line 7, in <module>
print(pytesseract.image_to_string(Image.open("example.png")))
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhangjc/.pyenv/versions/crawler/lib/python3.13/site-packages/pytesseract/pytesseract.py", line 486, in image_to_string
return {
~
...<2 lines>...
Output.STRING: lambda: run_and_get_output(*args),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}[output_type]()
~~~~~~~~~~~~~~^^
File "/home/zhangjc/.pyenv/versions/crawler/lib/python3.13/site-packages/pytesseract/pytesseract.py", line 489, in <lambda>
Output.STRING: lambda: run_and_get_output(*args),
~~~~~~~~~~~~~~~~~~^^^^^^^
File "/home/zhangjc/.pyenv/versions/crawler/lib/python3.13/site-packages/pytesseract/pytesseract.py", line 352, in run_and_get_output
run_tesseract(**kwargs)
~~~~~~~~~~~~~^^^^^^^^^^
File "/home/zhangjc/.pyenv/versions/crawler/lib/python3.13/site-packages/pytesseract/pytesseract.py", line 284, in run_tesseract
raise TesseractError(proc.returncode, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file /usr/share/tesseract-ocr/5/tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')

根据提示信息,需要设置 TESSDATA_PREFIX 环境变量指向包含 Tesseract 语言数据文件(如 eng.traineddata、fra.traineddata 等)的 tessdata 目录。通常该目录位置如下:

阅读全文 »

Selenium 是一个用于 Web 应用程序测试的工具。可以通过它驱动浏览器执行特定的操作,如点击、下滑、资源加载与渲染等。该工具在爬虫开发中也非常有帮助。Selenium 需要通过浏览器驱动操控浏览器,不同的浏览器对应的驱动不同,Chrome 浏览器的驱动是ChromeDriver,Firefox 浏览器的驱动是 GeckoDriver。要注意的是,浏览器驱动版本必须与计算机上的浏览器版本对应,否则无法正常使用。

打开 Chrome 浏览器后点击右上角三个点菜单中的“帮助”选项,并选择“关于 Google Chrome”​,即可看到版本信息:

114.0.5735.90 及以下版本,从 http://chromedriver.storage.googleapis.com/index.html 下载对应的版本。114.0.5735.90 以上版本,需要从 GitHub 项目 chrome-for-testing 中的 JSON API 端点文件 内容查找对应版本的下载地址。

阅读全文 »

本文方法是直接下载 GitHub 项目的 release 版本。项目地址:https://github.com/docker/compose

执行以下命令将发布程序加载至本地目录:

1
sudo wget -c -t 0 https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-`uname -s`-`uname -m` -O /opt/docker/docker-compose
阅读全文 »

注意事项

Deepin 20.9 社区版安装 Docker 需要注意两点:

  • 因为某些原因,Docker 官方源基本不可用,所以需要使用镜像源进行安装。当然也可以用安装包直接安装,但后续升级不够方便。
  • 需要确定对应 Debian 的版本及代号。
阅读全文 »

Deepin 是基于 Debian 的国产 Linux 发行版,安装 Docker Desktop 可能会遇到兼容性问题,因为 Docker Desktop 官方主要支持 Ubuntu/Debian/Red Hat/Fedora/Arch 等主流发行版,所以选择安装 Docker Engine。

  1. 卸载旧版本(如有)
1
sudo apt remove docker.io docker-doc docker-compose podman-docker containerd runc
阅读全文 »
0%