麒麟信安UniKylin3.3安装配置pyqt5运行环境

麒麟信安UniKylin3.3安装配置pyqt5运行环境

麒麟信安UniKylin3.3 Linux version 3.10.0-1062.9.1.ky3.kb2.pg.x86_64 (mockbuild@host-172-19-0-72) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Mar 26 05:50:47 UTC 2020

系统装了python2.7.5,未装python3。

0、准备

sudo vim /etc/yum.repos.d/Kylin-Base.repo

替换

:.,$s/$releasever/4/g

:.,$s/$basearch/x86_64/g

替换后:

# Kylin-Base.repo
[base]
name=UniKylin-4 - Base
gpgcheck=0
baseurl=file:///run/media/lh/UniKylin-3.3/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin-release

 

安装python需要的依赖:

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

 

1、安装 OpenSSL

https://www.openssl.org/ 下载openssl-1.1.1k.tar.gz并解压到openssl-1.1.1k

#./config --prefix=/usr/local/openssl shared
#sudo make 完成后/usr/local/openssl下没有东西
#sudo make install 完成后/usr/local/openssl下有了bin、lib等

 

此时运行openssl version,还会显示安装 OpenSSL 1.0.2k-fips 26 Jan 2017,但cd /usr/local/openssl/bin openssl version,会显示error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

 2、安装 LibreSSL

http://www.libressl.org/ 下载源代码。此处使用“libressl-2.8.2.tar.gz”下载解压

#./config --prefix=/usr/local/openssl shared
#sudo make
#sudo make install

此时/usr/local/openssl/bin/openssl version会显示error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

#sudo mv /usr/bin/openssl /usr/bin/openssl.bak
#sudo ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
#openssl version

显示LibreSSL 2.8.2

3、安装 Python3.9.5

export LDFLAGS=”-L/usr/local/openssl/lib”
export CPPFLAGS=”-I/usr/local/openssl/include/openssl”
export PKG_CONFIG_PATH=”/usr/local/openssl/lib/pkgconfig”

解压Python-3.9.5.tar.xz

cd Python-3.9.5
 ./configure --prefix=/usr/local/python39
 sudo make
 sudo make install

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

/usr/local/python39/bin/pip3 install pyqt5
/usr/local/python39/bin/pip3 install pyqt5-tools
/usr/local/python39/bin/python3.9 test1.py

显示This application failed to start because it could not find or load the Qt platform plugin “xcb”.

export QT_DEBUG_PLUGINS=1
/usr/local/python39/bin/python3.9 test1.py

显示This application failed to start because it could not find or load the Qt platform plugin “xcb”.

cd /home/lh/.local/lib/python3.7/site-packages/PyQt5/Qt5/plugins/platforms/
ldd libqxcb.so

显示libxkbcommon-x11.so.0 => not found

sudo yum install libxkbcommon-x11
cd /home/lh/.local/lib/python3.7/site-packages/PyQt5/Qt5/plugins/platforms/
ldd libqxcb.so

显示libxkbcommon-x11.so.0 => /usr/lib64/...

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

运行正常。

你可能感兴趣的:(技术参考,linux,python,麒麟信安,UniKylin3.3,pyqt5)