Qt for Python/GettingStarted/Windows: Difference between revisions
(adding versions of the install) |
No edit summary |
||
Line 9: | Line 9: | ||
* virtualenv (optional but recommended) | * virtualenv (optional but recommended) | ||
* Python sphinx package for documentation (optional, pip install sphinx) | * Python sphinx package for documentation (optional, pip install sphinx) | ||
=== Building from sources on Windows 10 === | === Building from sources on Windows 10 === | ||
The following steps are performed on the command prompt (''cmd''). | The following steps are performed on the command prompt (''cmd''). | ||
A 64bit infrastructure is assumed in the procedure, but if the host is a 32bit environment it is possible to just download the proper architecture packages. | A 64bit infrastructure is assumed in the procedure, but if the host is a 32bit environment it is possible to just download the proper architecture packages. | ||
The packages used on this process are: | The packages used on this process are: | ||
* 7zip (''7z1700-x64'') | * 7zip (''7z1700-x64'') | ||
Line 23: | Line 20: | ||
* CLANG (''libclang-release_39-windows-vs2015_64.7z'') | * CLANG (''libclang-release_39-windows-vs2015_64.7z'') | ||
* Qt 5.9.4 (''qt-unified-windows-x86-3.0.2-online'') | * Qt 5.9.4 (''qt-unified-windows-x86-3.0.2-online'') | ||
==== Setting up CLANG ==== | ==== Setting up CLANG ==== | ||
* Download [http://download.qt.io/development_releases/prebuilt/libclang/ libclang], e.g. | * Download [http://download.qt.io/development_releases/prebuilt/libclang/ libclang], e.g. | ||
[http://download.qt.io/development_releases/prebuilt/libclang/libclang-release_39-windows-vs2015_64.7z http://download.qt.io/development_releases/prebuilt/libclang/libclang-release_39-windows-vs2015_64.7z] | [http://download.qt.io/development_releases/prebuilt/libclang/libclang-release_39-windows-vs2015_64.7z http://download.qt.io/development_releases/prebuilt/libclang/libclang-release_39-windows-vs2015_64.7z] | ||
* Extract the files, e.g. using [http://www.7-zip.org/ 7zip] | * Extract the files, e.g. using [http://www.7-zip.org/ 7zip] | ||
* Move the directory ''libclang'' to any desire path, e.g ''c:\'', and then set an environment variable with the new path: | * Move the directory ''libclang'' to any desire path, e.g ''c:\'', and then set an environment variable with the new path: | ||
set LLVM_INSTALL_DIR=c:\libclang | set LLVM_INSTALL_DIR=c:\libclang | ||
==== Getting PySide2 ==== | ==== Getting PySide2 ==== | ||
* You must [https://git-scm.com/download/win download git] in order to clone the repository. | * You must [https://git-scm.com/download/win download git] in order to clone the repository. | ||
Line 38: | Line 32: | ||
* Checking out the version that we want to build, e.g. 5.9 (Keep in mind you need to use the same version as your Qt installation) | * Checking out the version that we want to build, e.g. 5.9 (Keep in mind you need to use the same version as your Qt installation) | ||
cd pyside-setup && git checkout 5.9 | cd pyside-setup && git checkout 5.9 | ||
==== Building PySide2 ==== | ==== Building PySide2 ==== | ||
* You must [https://www.python.org/downloads/windows/ download Python] to build PySide2 (3.6 is recommended) | * You must [https://www.python.org/downloads/windows/ download Python] to build PySide2 (3.6 is recommended) | ||
* Check your Qt installation path, to specifically use that version of ''qmake'' to build PySide2. | * Check your Qt installation path, to specifically use that version of ''qmake'' to build PySide2. | ||
e.g. ''E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe'' | e.g. ''E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe'' | ||
* Build can take a few minutes, so it is recommended to use more than one CPU core (e.g. 8). Remember to replace the paths to your current ''qmake'' path: | * Build can take a few minutes, so it is recommended to use more than one CPU core (e.g. 8). Remember to replace the paths to your current ''qmake'' path: | ||
python setup.py build --qmake=E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe --build-tests --ignore-git --jobs=8 | python setup.py build --qmake=E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe --build-tests --ignore-git --jobs=8 | ||
==== Installing PySide2 ==== | ==== Installing PySide2 ==== | ||
* To install on the current directory, just run: | * To install on the current directory, just run: | ||
python setup.py install --qmake=E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe --build-tests --ignore-git --jobs=8 | python setup.py install --qmake=E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe --build-tests --ignore-git --jobs=8 | ||
==== Test installation ==== | ==== Test installation ==== | ||
* You can execute one of the examples to verify the process is properly working. | * You can execute one of the examples to verify the process is properly working. | ||
* Remember to properly set the environment variables for Qt and PySide2. | * Remember to properly set the environment variables for Qt and PySide2. | ||
python examples/examples/widgets/widgets/tetrix.py | python examples/examples/widgets/widgets/tetrix.py | ||
== Development == | |||
== Development == | Development happens in the 5.9 and dev branches of the [http://code.qt.io/cgit/pyside/pyside-setup.git/ pyside-setup repository]. | ||
Development happens in the 5.9 and dev branches of the [http://code.qt.io/cgit/pyside/pyside-setup.git/ pyside-setup repository]. | |||
The top level repository has the following submodules: | The top level repository has the following submodules: | ||
* sources/pyside2-tools: uic, rcc tools | * sources/pyside2-tools: uic, rcc tools | ||
* examples/ | * examples/ | ||
Contributions follow the [[Qt_Project_Guidelines|standard process]]. | |||
Contributions follow the [[Qt_Project_Guidelines|standard process]]. | |||
It is helpful to have debug binaries and/or symbols for Python available. | It is helpful to have debug binaries and/or symbols for Python available. | ||
On Windows, this is done by choosing ''Customized Installation'' when installing Python and ticking the respective check boxes. | On Windows, this is done by choosing ''Customized Installation'' when installing Python and ticking the respective check boxes. | ||
It is also recommended to use a [http://docs.python-guide.org/en/latest/dev/virtualenvs/ Virtual Environment] for testing to be able to always start from a clean base and avoid issues with write permissions in installations. | |||
It is also recommended to use a [http://docs.python-guide.org/en/latest/dev/virtualenvs/ Virtual Environment] for testing to be able to always start from a clean base and avoid issues with write permissions in installations. | |||
On Windows an installation step may be required: | On Windows an installation step may be required: | ||
python -m pip install virtualenv | python -m pip install virtualenv | ||
python -m virtualenv testenv | python -m virtualenv testenv | ||
The Virtual Environment is activated by· | The Virtual Environment is activated by· | ||
CALL testenv\Scripts\activate.bat | CALL testenv\Scripts\activate.bat | ||
Before building the first time, the module [http://www.sphinx-doc.org/en/1.4.9/ Sphinx] should be installed into the virtual environment:· | Before building the first time, the module [http://www.sphinx-doc.org/en/1.4.9/ Sphinx] should be installed into the virtual environment:· | ||
pip install sphinx | pip install sphinx |
Revision as of 12:29, 29 January 2018
The Qt library has to be built with the same version of MSVC as Python and PySide2, this can be selected when using the online installer.
Requirements
- Qt package from https://www.qt.io or a custom build of Qt (preferably Qt 5.9)
- Python from https://www.python.org/downloads/ (Python 3.6 or Python 2.7)
- MSVC2015 (for Python 3 on Windows), MSCVC2008 (for Python 2 on Windows)
- CMake from https://cmake.org/download/ (>= 3.1)
- libclang (required for the 5.9 and dev branches) from download.qt.io (>= 3.9)
- virtualenv (optional but recommended)
- Python sphinx package for documentation (optional, pip install sphinx)
Building from sources on Windows 10
The following steps are performed on the command prompt (cmd). A 64bit infrastructure is assumed in the procedure, but if the host is a 32bit environment it is possible to just download the proper architecture packages. The packages used on this process are:
- 7zip (7z1700-x64)
- Git (Git-2.15.1.2-64)
- CMake (cmake-3.10.2-win64-x64)
- Python (python-3.6.4-amd64)
- MSVC2015 (visualcppbuildtools_full)
- CLANG (libclang-release_39-windows-vs2015_64.7z)
- Qt 5.9.4 (qt-unified-windows-x86-3.0.2-online)
Setting up CLANG
- Download libclang, e.g.
http://download.qt.io/development_releases/prebuilt/libclang/libclang-release_39-windows-vs2015_64.7z
- Extract the files, e.g. using 7zip
- Move the directory libclang to any desire path, e.g c:\, and then set an environment variable with the new path:
set LLVM_INSTALL_DIR=c:\libclang
Getting PySide2
- You must download git in order to clone the repository.
- Clonning the official repository
git clone --recursive https://codereview.qt-project.org/pyside/pyside-setup
- Checking out the version that we want to build, e.g. 5.9 (Keep in mind you need to use the same version as your Qt installation)
cd pyside-setup && git checkout 5.9
Building PySide2
- You must download Python to build PySide2 (3.6 is recommended)
- Check your Qt installation path, to specifically use that version of qmake to build PySide2.
e.g. E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe
- Build can take a few minutes, so it is recommended to use more than one CPU core (e.g. 8). Remember to replace the paths to your current qmake path:
python setup.py build --qmake=E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe --build-tests --ignore-git --jobs=8
Installing PySide2
- To install on the current directory, just run:
python setup.py install --qmake=E:\Qt\5.9.4\msvc2015_64\bin\qmake.exe --build-tests --ignore-git --jobs=8
Test installation
- You can execute one of the examples to verify the process is properly working.
- Remember to properly set the environment variables for Qt and PySide2.
python examples/examples/widgets/widgets/tetrix.py
Development
Development happens in the 5.9 and dev branches of the pyside-setup repository. The top level repository has the following submodules:
- sources/pyside2-tools: uic, rcc tools
- examples/
Contributions follow the standard process. It is helpful to have debug binaries and/or symbols for Python available. On Windows, this is done by choosing Customized Installation when installing Python and ticking the respective check boxes. It is also recommended to use a Virtual Environment for testing to be able to always start from a clean base and avoid issues with write permissions in installations. On Windows an installation step may be required:
python -m pip install virtualenv python -m virtualenv testenv
The Virtual Environment is activated by·
CALL testenv\Scripts\activate.bat
Before building the first time, the module Sphinx should be installed into the virtual environment:·
pip install sphinx