我正在尝试在我的 rasperberry pi 4 上安装 OpenCV,但它给了我很多错误
pi@raspberrypi:~ $ sudo dphys swapfile swapoff
sudo: dphys: command not found
pi@raspberrypi:~ $ apt-get install dphys-swapfile
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
pi@raspberrypi:~ $ sudo apt-get update
Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Reading package lists... Done
pi@raspberrypi:~ $ sudo apt-get install dphys-swapfile
Reading package lists... Done
Building dependency tree
Reading state information... Done
dphys-swapfile is already the newest version (20100506-5+rpt2).
The following packages were automatically installed and are no longer required:
alsa-base freetype2-doc gconf-service gconf2-common gstreamer0.10-alsa gstreamer0.10-plugins-base libdrm-etnaviv1 libexiv2-14 libgconf-2-4 libgfortran3 libgmime-2.6-0 libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libllvm6.0
libmicrodns0 libncurses5 libpng-tools libva-wayland2 libxfce4util-bin libxfce4util-common libxfce4util7 libxfconf-0-2 lxplug-volume pimixer point-rpi python3-pyperclip uuid-dev xfconf
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up dphys-swapfile (20100506-5+rpt2) ...
Job for dphys-swapfile.service failed because the control process exited with error code.
See "systemctl status dphys-swapfile.service" and "journalctl -xe" for details.
invoke-rc.d: initscript dphys-swapfile, action "restart" failed.
\u25cf dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file
Loaded: loaded (/lib/systemd/system/dphys-swapfile.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-05-19 06:23:28 EDT; 27ms ago
Docs: man:dphys-swapfile(8)
Process: 6025 ExecStart=/sbin/dphys-swapfile setup (code=exited, status=0/SUCCESS)
Process: 6048 ExecStart=/sbin/dphys-swapfile swapon (code=exited, status=255/EXCEPTION)
Main PID: 6048 (code=exited, status=255/EXCEPTION)
May 19 06:23:28 raspberrypi systemd[1]: Starting dphys-swapfile - set up, mount/unmount, and delete a swap file...
May 19 06:23:28 raspberrypi dphys-swapfile[6025]: want /var/swap=2048MByte, checking existing: keeping it
May 19 06:23:28 raspberrypi dphys-swapfile[6048]: swapon: /var/swap: swapon failed: Invalid argument
May 19 06:23:28 raspberrypi systemd[1]: dphys-swapfile.service: Main process exited, code=exited, status=255/EXCEPTION
May 19 06:23:28 raspberrypi systemd[1]: dphys-swapfile.service: Failed with result 'exit-code'.
May 19 06:23:28 raspberrypi systemd[1]: Failed to start dphys-swapfile - set up, mount/unmount, and delete a swap file.
dpkg: error processing package dphys-swapfile (--configure):
installed dphys-swapfile package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
dphys-swapfile
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@raspberrypi:~ $
如果有人可以分享我遗漏或需要采取的步骤,将不胜感激