How to install PySide on CentOS?

2019-04-26 17:58发布

I want to install ReText on CentOS. Have a problem,

[root@localhost scripts-2.6]# python retext.py 
Traceback (most recent call last):
  File "retext.py", line 23, in <module>
    from ReText import QtCore, QtWidgets, QtWebKit, datadirs, globalSettings
  File "/usr/lib/python2.6/site-packages/ReText/__init__.py", line 21, in <module>
    from PySide import QtCore, QtGui, QtWebKit
ImportError: No module named PySide

Then I typed yum install PySide and yum install python-pyside to install PySide, and got the message No package available.

Also I tried yum search pyside and yum search python-, but that did not find the PySide package.

3条回答
聊天终结者
2楼-- · 2019-04-26 18:32

There is no "python-pyside" package in EPEL 7: http://dl.fedoraproject.org/pub/epel/7/x86_64/repoview/letter_p.group.html

That is why you can't use the proposed by Nir Ben-Or solution for CentOS 7.

I have solved this with pip install, however you may need to install some prerequisites first.

1) install RPM packages (UPDATED thanks to @fredrik for a comment):

qt-webkit-devel
libxml2-devel
libxslt-devel
rpmdevtools
gcc
gcc-c++
qt-devel
cmake
python-devel
python-pip

Build of pyside should tell you if some RPM-s are missing.

2) if you qmake program is not "/usr/bin/qmake" you may need to do something like this:

sudo ln -s /usr/bin/qmake-qt4 /usr/bin/qmake

3) install pyside via pip (this will take some time for build to complete):

sudo pip install pyside
查看更多
冷血范
3楼-- · 2019-04-26 18:54

The CentOS repository does not contain PySide. You can add the EPEL repository to your OS then use: yum install -y python-pyside and it will be installed on your system.

In order to install the EPEL repository for 64bit systems, run the following as root:

  1. cd /tmp
  2. wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  3. rpm -ivh epel-release-6-8.noarch.rpm

If you're using a 32bit system, use the following in step 2:

wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

查看更多
叼着烟拽天下
4楼-- · 2019-04-26 18:58

This is for CentOS 7.

First, make sure you've got the prerequisites:

sudo yum install epel-release
sudo yum install cmake qt-devel qt-webkit-devel libxml2-devel libxslt-devel python-devel rpmdevtools gcc gcc-c++ make python-pip
sudo ln -s /usr/bin/qmake-qt4 /usr/bin/qmake

Now you should be able to install PySide:

sudo pip install PySide
查看更多
登录 后发表回答