中标麒麟桌面版7.0(NeoKylin linux desktop release 7.0)配置pyqt5运行环境说明

操作系统安装好后,系统安装了python2.79和python3.42及pip

1、尝试用自带python3安装pyqt5

pip3 install pyqt5

会报错:

Downloading/unpacking pyqt5

Downloading PyQt5-5.15.4.tar.gz (3.3MB): 3.3MB downloaded

Running setup.py (path:/tmp/pip_build_lh/pyqt5/setup.py) egg_info for package pyqt5

Traceback (most recent call last):

File "<string>", line 17, in <module>

File "/usr/lib64/python3.4/tokenize.py", line 437, in open

buffer = builtins.open(filename, 'rb')

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip_build_lh/pyqt5/setup.py'

Complete output from command python setup.py egg_info:

Traceback (most recent call last):

File "<string>", line 17, in <module>

File "/usr/lib64/python3.4/tokenize.py", line 437, in open

buffer = builtins.open(filename, 'rb')

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip_build_lh/pyqt5/setup.py'

----------------------------------------

Cleaning up...

Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_lh/pyqt5

Storing debug log for failure in /home/lh/.pip/pip.log

2、安装新版python3,现在是python3.9.5

安装python需要的依赖

sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

下载解压编译

cd Python-3.9.5/

./configure --prefix=/usr/local/python39

sudo make

报错

UILD_CORE_MODULE

/home/lh/Python-3.9.5/Modules/_ctypes/_ctypes.c:107:17: 致命错误:ffi.h:没有那个文件或目录

#include <ffi.h>

^

编译中断。

升级软件环境

sudo yum update -y

再编译

sudo make clean

./configure --prefix=/usr/local/python39

sudo make

sudo make install

安装正确会提示已安装pip、pip3,在/usr/local/python39/bin下,可以添加到环境变量路径。

3、安装pyqt5

/usr/local/python39/bin/pip3 install pyqt5

/usr/local/python39/bin/pip3 install pyqt5-tools

4、测试

/usr/local/python39/bin/python3 test1.py

报错

relocationerror:/opt/Qt5.12.1/Tools/QtCreator/lib/Qt/lib/libQt5DBus.so.5:symbol dbus_message_set_allow_interactive_authorization,version LIBDBUS_1_3 not defined in file libdbus-1.so.3 with link time reference

下载https://dbus.freedesktop.org/releases/dbus/dbus-1.13.10.tar.xz解压

cd dbus-1.13.10

./configure --prefix=/home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

make

cd ./dbus/.libs

sudo cp libdbus-1.so /home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

sudo cp libdbus-1.so.3 /home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

sudo cp libdbus-1.so.3.26.0 /home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

再测试

/usr/local/python39/bin/python3 test1.py

报错

symbol lookup error: /opt/Qt5.12.1/Tools/QtCreator/lib/Qt/plugins/platforms/../../lib/libQt5XcbQpa.so.5: undefined symbol: FT_Get_Font_Format

下载https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.gz解压

cd freetype-2.10.0

./configure --prefix=/home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

make

cd ./objs/.libs

sudo cp libfreetype.so /home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

sudo cp libfreetype.so.6 /home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

sudo cp libfreetype.so.6.17.0 /home/lh/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib

再测试

/usr/local/python39/bin/python3 test1.py

成功。

参考:https://blog.csdn.net/codeaftercode/article/details/107584151  解决中标麒麟7安装Qt5.12.1后无法启动的问题[LIBDBUS_1_3 not defined][FT_Get_Font_Format]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值