一、安装Qt5.15.2
1.下载源码首先在官网下载Qt5.15.2的源码:https://download.qt.io/archive/qt/5.15/5.15.2/single/
2.先安装编译qt的环境
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install freeglut3-dev
sudo apt-get install gdb
sudo apt-get install cmake
sudo apt-get install libxcb-xinerama0-dev
sudo apt-get install libfontconfig1-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
在编译前,先检查一下本机是否有安装交叉编译工具,我们这里选用的交叉编译工具是aarch64-linux-gnu-g++ ,
在终端输入aarch64-linux-gnu- 然后按两次tab键 会看到下面列表,说明本机已经安装过了.
如果没有的话,需要先安装,可以通过命令先查看有哪些版本可以安装:sudo apt-cache search aarch64
3. 解压
输入命令 xz -d qt-everywhere-src-5.15.2.tar.xz 先将 qt-everywhere-src-5.15.2.tar.xz解压成qt-everywhere-src-5.15.2.tar
然后输入命令 tar xvf qt-everywhere-src-5.10.1.tar来解包。
4.进入源码文件目录
cd qt-everywhere-src-5.15.2
5.编译安装(must enable xcb here manually)
./configure -xcb(不能加sudo)
Choose “o” to install Qt open source version. 选择‘y’
make -j4
sudo make install
6.通过终端安装一个QtCreator:
sudo apt-get install qtcreator
问题:但是安装完成后打开会提示:
以下插件有错误,无法载入:QmlDesigner QmlProfiler
插件初始化失败:cannot Create OpenGL context 。暂时没找到解决办法,所以只能自己源码编译
7.源码编译QtCreator:
git clone --recursive https://code.qt.io/qt-creator/qt-creator.git
后面编译部分参考官方wiki教程:Building Qt Creator from Git - Qt Wiki
参考链接:统信uos编译安装qt5.15.2和qtcreator_seedlint的博客-CSDN博客_uos 安装qtcreator
一、安装PySide2
1.Install PySide2 from whl
git clone https://github.com/chentongwilliam/PySide2-jetson-nano.git
pip3 install shiboken2-5.15.2.1-5.15.3-cp36-cp36m-linux_aarch64.whl
pip3 install shiboken2_generator-5.15.2.1-5.15.3-cp36-cp36m-linux_aarch64.whl
pip3 install PySide2-5.15.2.1-5.15.3-cp36-cp36m-linux_aarch64.whl
2.Or Install PySide2 from Source
环境要求:
before install PySide2, first we have to deal with some requirements: General requirements: Python: 3.5+, Qt: 5.12+, libclang: version10, CMake:3.1+, llvm: version10(clang10)
sudo apt install libclang-10-dev
sudo apt install llvm
Here I personally suggest use synaptic to manage library:
sudo apt-get install synaptic
synaptic
Then install the correct version(10) of libclang and llvm via synaptic.
download and build PySide2:
git clone http://code.qt.io/pyside/pyside-setup.git
cd pyside-setup/
git checkout 5.15.3
Finally, to install PySide2:
sudo apt install python3-pip
sudo python3 setup.py install --qmake=/usr/local/Qt-5.15.2/bin/qmake
copy fonts
sudo mkdir /usr/local/Qt-5.15.3/lib/fonts
sudo chmod 777 /usr/local/Qt-5.15.3/lib/fonts
then copy all fonts you like (for example all fonts in /usr/share/fonts/truetype/ubuntu/) to /usr/local/Qt-5.15.3/lib/fonts
人工智能编译方法,供参考:
PySide2是Qt的Python绑定库,它允许使用Python编写Qt应用程序。下面是在Ubuntu下编译安装PySide2的步骤:
- 安装Qt5及相关依赖库:
sudo apt install qtbase5-dev qttools5-dev-tools libqt5svg5-dev libxml2-dev libxslt1-dev
- 安装Python开发包:
sudo apt install python3-dev python3-pip
- 安装PySide2的依赖库:
sudo apt install libxcb-xinerama0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-render-util0-dev libxcb-xkb-dev libxkbcommon-x11-dev libxkbcommon-dev libfontconfig1-dev libfreetype6-dev libpng-dev libjpeg-dev libglib2.0-dev libicu-dev
- 安装CMake:
sudo apt install cmake
- 下载PySide2源代码:
git clone https://code.qt.io/pyside/pyside-setup.git
cd pyside-setup
git submodule update --init --recursive
- 构建PySide2:
mkdir build
cd build
cmake ..
make
- 安装PySide2:
sudo make install
完成安装后,可以在Python中导入PySide2模块进行测试:
python3
>>> from PySide2.QtWidgets import QApplication, QLabel
>>> app = QApplication([])
>>> label = QLabel('Hello, PySide2!')
>>> label.show()
>>> app.exec_()
这将创建一个简单的窗口,显示文本“Hello, PySide2!”
参考链接:https://github.com/chentongwilliam/PySide2-jetson-nano#install-pyside2