在Travis CI上使用Python3安装PyQt4

时间:2016-02-19 19:05:24

标签: python-3.x pyqt4 travis-ci

我试图在Travis CI上至少成功构建一个但是到目前为止没有运气(7个错误的构建)

问题是我使用的是PyQt4,它似乎太复杂了,无法让它与Travis一起使用。

我的 .travis.yml

language: python
python:
  - "3.5"
before_install:
    #- sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
    #- sudo apt-get install python3-sip python3-sip-dev python3-pyqt4 cmake
  - sudo mkdir -p /downloads
  - sudo chmod a+rw /downloads
  - curl -L http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.5/sip-4.16.5.tar.gz -o /downloads/sip.tar.gz 
  - curl -L http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.3/PyQt-x11-gpl-4.11.3.tar.gz -o /downloads/pyqt4.tar.gz
  # Builds
  - sudo mkdir -p /builds
  - sudo chmod a+rw /builds
install:
  # Qt4
  - pushd /builds
  # SIP
  - tar xzf /downloads/sip.tar.gz --keep-newer-files
  - pushd sip-4.16.5
  - python configure.py
  - make
  - sudo make install
  - popd
  # PyQt4
  - tar xzf /downloads/pyqt4.tar.gz --keep-newer-files
  - pushd PyQt-x11-gpl-4.11.3
  - python configure.py -c --confirm-license --no-designer-plugin -e QtCore -e QtGui
  - make
  - sudo make install
  - popd
  # Builds Complete
  - popd
  - pip install -r requirements.txt

运行脚本之前的所有内容都可以。在脚本运行之后,Travis说:

  

错误:失败:ImportError(没有名为'PyQt4'的模块)

我做错了什么?

1 个答案:

答案 0 :(得分:1)

工作配置。

language: python
python:
  - "3.5"
before_install:
    - sudo mkdir -p /downloads
    - sudo chmod a+rw /downloads
    - curl -L http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.5/sip-4.16.5.tar.gz -o /downloads/sip.tar.gz 
    - curl -L http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.3/PyQt-x11-gpl-4.11.3.tar.gz -o /downloads/pyqt4.tar.gz
    # Builds
    - sudo mkdir -p /builds
    - sudo chmod a+rw /builds

install:
    - export DISPLAY=:99.0
    - sh -e /etc/init.d/xvfb start
    - sudo apt-get install -y libqt4-dev
    - sudo apt-get install -y mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
#    - sudo apt-get install -y python3-sip python3-sip-dev python3-pyqt4 cmake
    # Qt4
    - pushd /builds
    # SIP
    - tar xzf /downloads/sip.tar.gz --keep-newer-files
    - pushd sip-4.16.5
    - python configure.py
    - make
    - sudo make install
    - popd
    # PyQt4
    - tar xzf /downloads/pyqt4.tar.gz --keep-newer-files
    - pushd PyQt-x11-gpl-4.11.3
    - python configure.py -c --confirm-license --no-designer-plugin -e QtCore -e QtGui -e QtTest
    - make
    - sudo make install
    - popd
    # Builds Complete
    - popd
    - pip install -r requirements.txt