Recommended way for installing PySide on Ubuntu

后端 未结 4 881
死守一世寂寞
死守一世寂寞 2021-02-19 08:15

What is the recommended way of setting up PySide for development in Ubuntu?

  1. sudo apt-get install python3-pyside?
  2. sudo pip install pysid
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-19 08:40

    For all Python packages at this point I prefer to use pip, and not even the ubuntu-managed pip but a custom install. It is better not to mix the two, i.e. if you already have packages installed using the python3-pip Ubuntu package, continue using that.

    To install custom pip for a single user, you can first set up the latest version of pip as described here:

    https://pip.pypa.io/en/stable/installing/

    That is, in short:

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    
    python3 ./get-pip.py
    

    To install PySide with the custom pip use:

    pip install --user PySide2
    

    To install PySide with the pip from an Ubuntu-managed apt package (thanks @Suzanne Dupéron for the update on that):

    sudo apt install python3-pip && pip3 install PySide2
    

    Currently**, if you have Qt 5.x set as default on your Ubuntu, you may find that

    sudo apt-get install python3-pyside
    

    (or python-pyside if you still for some reason want the python 2.7 version) is the only way (without having to revert to Qt 4.x).

    The other two ways would return errors of the sort: "Qt QTCORE library not found."

    **check the original post date.PySide page on python.org read/reads "PySide requires Python 2.6 or later and Qt 4.6 or better. Qt 5.x is currently not supported."

    [EDIT] Thanks to @JBentley for the update: PySide now supports Qt5.

提交回复
热议问题