按照官网Linux上安装cfclient的教程:
From a fresh Ubuntu 20.04 system and up, running the client form source requires git, pip and a lib for the Qt GUI.
sudo apt install git python3-pip libxcb-xinerama0 libxcb-cursor0
pip3 install --upgrade pip
Clone the repository with git
git clone https://github.com/bitcraze/crazyflie-clients-python
cd crazyflie-clients-python
Installing the client
All other dependencies on linux are handled by pip so to install an editable copy simply run:
pip3 install -e .
遇到问题一:
运行pip3 install -e .时报错如下:
怀疑可能是PyQt的问题,于是查了PyQt及pip是否正常可用,均为正常。于是检查版本,版本正常。
但是在运行pip3 install --upgrade pip时,有一条warning:
WARNING: The scripts pip, pip3, pip3.10 and pip3.8 are installed in '/home/wzh-2004/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
于是,按照此warning,在.bashrc文件最后一行加入变量:
export PATH="$HOME/.local/bin:$PATH"
并在终端中输入以下命令,使变量立即生效。
source ~/.bashrc
再次运行 pip3 install -e . 可正常安装。
遇到问题二:
使用cfclient命令启动客户端时,无法启动。
看起来出现了关于Qt平台插件的加载问题。错误消息表明应用程序无法初始化任何Qt平台插件,因此无法启动。
在Linux系统上,Qt应用程序通常需要XCB(X protocol C-language Binding)平台插件来与X Window系统进行通信。如果缺少必要的依赖项或配置不正确,就会出现无法加载Qt平台插件的错误。
解决此问题的一种方法是安装所需的依赖项。根据错误消息,尝试安装libxcb-xinerama0
和xcb-cursor0
或libxcb-cursor0
。可以使用以下命令安装这些依赖项:
sudo apt install libxcb-xinerama0 xcb-cursor0
或者,根据系统可能需要使用libxcb-cursor0
替代xcb-cursor0
:
sudo apt install libxcb-xinerama0 libxcb-cursor0
安装完成后,尝试重新运行cfclient
命令,问题得到解决。