目录
- 1.打开我提供的文件or官网自己下载(需对应PyQt5的版本)
- 2.解压文件
- 3.进入目录
- 4.安装clang
- 5. 编译安装
- 6.报错: error: ‘NPY_ARRAY_UPDATEIFCOPY’ was not declared in this scope
- 7.又报错:error: ‘NPY_ARRAY_UPDATEIFCOPY’ was not declared in this scope
- 8.验证成功编译安装
系统:jetson-nano-jp451-sd-card-image
ubuntu 18.04
1.打开我提供的文件or官网自己下载(需对应PyQt5的版本)
不太熟悉的可以参考我的另一篇博文,jetson nano——编译安装Qt
我提供的文件:pyside-setup-opensource-src-5.15.2.tar.xz
链接:https://pan.baidu.com/s/1kJ0P4xCxGTtTYZqjH6603w?pwd=gmwz
提取码:gmwz
2.解压文件
tar xJvf pyside-setup-opensource-src-5.15.2.tar.xz
3.进入目录
cd pyside-setup-opensource-src-5.15.2/
4.安装clang
#1.
sudo apt-get update
#2.
sudo apt-get install clang
#3.
sudo apt-get install libclang-dev
5. 编译安装
我尝试进行并行编译,在调用 setup.py 之前设置了 MAKEFLAGS 环境变量,来指定并行编译的参数。算是个实验吧,反正看着CPU的确跑满了。
export MAKEFLAGS=-j8
python setup.py install
6.报错: error: ‘NPY_ARRAY_UPDATEIFCOPY’ was not declared in this scope
说,找不见numpy的头文件?????,我查看了有numpy并且是最新版,然后我在虚拟环境进行搜索:find /home/ymck/archiconda3/envs/dc38 -name “arrayobject.h” ,可以找见,如下图:
#(dc38) ymck@ymck-desktop:~/pyside2/pyside-setup-opensource-src-5.15.2$ find /home/ymck/archiconda3/envs/dc38 -name "arrayobject.h"
#/home/ymck/archiconda3/envs/dc38/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h
解决方法:
#1.直接指定cmake编译的numpy头文件路径:
export CMAKE_INCLUDE_PATH=/home/ymck/archiconda3/envs/dc38/lib/python3.8/site-packages/numpy/core/include
#2.执行
python setup.py install
7.又报错:error: ‘NPY_ARRAY_UPDATEIFCOPY’ was not declared in this scope
解决方案:编辑 sbknumpyarrayconverter.cpp 文件并将 NPY_ARRAY_UPDATEIFCOPY 替换为 NPY_ITER_UPDATEIFCOPY
#1.
sed -i 's/NPY_ARRAY_UPDATEIFCOPY/NPY_ITER_UPDATEIFCOPY/g' /home/ymck/pyside2/pyside-setup-opensource-src-5.15.2/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
#2.
python setup.py install
然后编译目前我没报错,如下图所示:
8.验证成功编译安装
#1.
python
#2.
import PySide2
结果如下图,成功安装: