comparison Sphinx/source/plugins/python.rst @ 800:83beec704c98

python windows usage
author Alain Mazy <am@osimis.io>
date Tue, 21 Dec 2021 15:18:58 +0100
parents ecf431e1bd44
children db20ad016bc2
comparison
equal deleted inserted replaced
799:ecf431e1bd44 800:83beec704c98
109 109
110 110
111 `Here <https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/python/>`__ is a full example 111 `Here <https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/python/>`__ is a full example
112 of a more complex setup using the :ref:`osimis/orthanc <docker-osimis>` images. 112 of a more complex setup using the :ref:`osimis/orthanc <docker-osimis>` images.
113 113
114
115 Microsoft Windows
116 .................
117
118 Pre-compiled binaries for Microsoft Windows `are also available
119 <https://www.orthanc-server.com/browse.php?path=/plugin-python>`__.
120
121 Beware that one version of the Python plugin can only be run against
122 one version of the Python interpreter. This version is clearly
123 indicated in the filename of the precompiled binaries.
124
125 Pay also attention to pick the right 32/64 bits version. If you are
126 running Orthanc 64bits, install Python in 64bits and select the 64bits
127 Python plugin too.
128
129 When you install Python on your Windows machine, make sure to install
130 Python for ``All Users`` and select the ``Add Python to Path`` option.
131
114 Compiling from source 132 Compiling from source
115 ..................... 133 .....................
134
135 For GNU/Linux
136 ^^^^^^^^^^^^^
116 137
117 .. highlight:: bash 138 .. highlight:: bash
118 139
119 The procedure to compile this plugin from source is similar to that 140 The procedure to compile this plugin from source is similar to that
120 for the :ref:`core of Orthanc <compiling>`. The following commands 141 for the :ref:`core of Orthanc <compiling>`. The following commands
146 $ cmake .. -DPYTHON_VERSION=3.8 -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release \ 167 $ cmake .. -DPYTHON_VERSION=3.8 -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release \
147 -DPYTHON_LIBRARY=/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib \ 168 -DPYTHON_LIBRARY=/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib \
148 -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/ 169 -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/
149 170
150 171
151 Microsoft Windows 172 For Microsoft Windows
152 ................. 173 ^^^^^^^^^^^^^^^^^^^^^
153
154 Pre-compiled binaries for Microsoft Windows `are also available
155 <https://www.orthanc-server.com/browse.php?path=/plugin-python>`__.
156
157 Beware that one version of the Python plugin can only be run against
158 one version of the Python interpreter. This version is clearly
159 indicated in the filename of the precompiled binaries.
160 174
161 .. highlight:: text 175 .. highlight:: text
162 176
163 You are of course free to compile the plugin from sources. You'll have 177 You are of course free to compile the plugin from sources. You'll have
164 to explicitly specify the path to your Python installation while 178 to explicitly specify the path to your Python installation while
165 invoking CMake. For instance:: 179 invoking CMake. For instance::
166 180
167 C:\orthanc-python\Build> cmake .. -DPYTHON_VERSION=2.7 -DPYTHON_WINDOWS_ROOT=C:/Python27 \ 181 C:\orthanc-python\Build> cmake .. -DPYTHON_VERSION=3.8 -DPYTHON_WINDOWS_ROOT=C:/Python38 \
168 -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 15 2017" 182 -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 15 2017"
169 183
170 **Note about debug builds**: Usually, building Python modules such as the Python 184 **Note about debug builds**: Usually, building Python modules such as the Python
171 plugin for Orthanc in debug mode (where ``_DEBUG`` is defined) leads to a module 185 plugin for Orthanc in debug mode (where ``_DEBUG`` is defined) leads to a module
172 (``.exe`` or ``.dll``) that requires a debug build of Python, and debug versions of all 186 (``.exe`` or ``.dll``) that requires a debug build of Python, and debug versions of all
183 In case you need to use the Python debug libraries, you can instruct the build 197 In case you need to use the Python debug libraries, you can instruct the build
184 system to do so by setting the ``PYTHON_WINDOWS_USE_RELEASE_LIBS`` CMake option, 198 system to do so by setting the ``PYTHON_WINDOWS_USE_RELEASE_LIBS`` CMake option,
185 that is ``ON`` by default, to ``OFF``. The previous build example would then be, 199 that is ``ON`` by default, to ``OFF``. The previous build example would then be,
186 should you require a full debug build:: 200 should you require a full debug build::
187 201
188 C:\orthanc-python\Build> cmake .. -DPYTHON_VERSION=2.7 -DPYTHON_WINDOWS_ROOT=C:/Python27 \ 202 C:\orthanc-python\Build> cmake .. -DPYTHON_VERSION=3.8 -DPYTHON_WINDOWS_ROOT=C:/Python38 \
189 -DSTATIC_BUILD=ON -DPYTHON_WINDOWS_USE_RELEASE_LIBS=OFF \ 203 -DSTATIC_BUILD=ON -DPYTHON_WINDOWS_USE_RELEASE_LIBS=OFF \
190 -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 15 2017" 204 -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 15 2017"
191 205
192 Please note that this CMake option only impacts **debug** builds under Windows, 206 Please note that this CMake option only impacts **debug** builds under Windows,
193 when using (any version of) the Microsoft Visual Studio compiler. 207 when using (any version of) the Microsoft Visual Studio compiler.