background preloader

PYTHON

Facebook Twitter

Python Scripte mit PyInstaller als .exe verteilen - Marco Gabriel. Wozu der Aufwand?

Python Scripte mit PyInstaller als .exe verteilen - Marco Gabriel

Es kommt der Tag, an dem man seine Python Scripte ausserhalb seiner Entwicklungsumgebung einsetzen möchte. Von anderen Programmiersprachen kennt man die Möglichkeit, die Programme zu compilieren und diese unter Windows als ausführbare .exe oder .dll Dateien zu verteilen. Compilieren im eigentlichen Sinn lässt sich ein Python Script nicht. Man kann jedoch Python Scripte auch in .exe verwandeln und diese verteilen.

Der Grund dafür kann sein, daß man nicht überall eine installierte Python-Umgebung voraussetzen möchte oder auch um seinen Quellcode gegen neugierige Blicke oder Änderungen zu schützen. Welche Möglichkeiten gibt es? Beispielhafte Anwendung mit PyInstaller. Writing C/C++ Python extensions without Microsoft Visual C++ Or "Creating Python extensions in C/C++ with SWIG and compiling them with MinGW gcc under Windows" or "Installing Python extension with distutils and without Microsoft Visual C++".

Writing C/C++ Python extensions without Microsoft Visual C++

This page is located at This page was written by Sébastien SAUVAGE <sebsauvage at sebsauvage dot net>. Last update : July 26th, 2003. This page is a cookbook for creating Python extensions in C/C++ under Windows with SWIG, distutils and gcc (MinGW version). It may also prove to be more generally helpful in installing/compiling existing C/C++ Python extension without Microsoft Visual C++ compiler.

Note: This documentation is outdated and may not be relevant against the most recent versions of Python, SWIG and MinGW (See notes at the end of the document). What's the point ? Under Windows, if you do not have the costly Microsoft Visual C++, you cannot install Python extensions written in C. This page will help to achieve exaclty this (and more: create your own extensions) with the opensource compiler gcc. Python Extension Packages for Windows - Christoph Gohlke. By Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine.

Python Extension Packages for Windows - Christoph Gohlke

This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language. The files are unofficial (meaning: informal, unrecognized, personal, unsupported, no warranty, no liability, provided "as is") and made available for testing and evaluation purposes. If downloads fail reload this page, enable JavaScript, disable download managers, disable proxies, clear cache, and use Firefox. Please only download files manually as needed. Most binaries are built from source code found on PyPI or in the projects public revision control systems. Refer to the documentation of the individual packages for license restrictions and dependencies.

Use pip version 8 or newer to install the downloaded .whl files. Install numpy+mkl before other packages that depend on it. Build Environment. Tentative NumPy Tutorial - Please do not hesitate to click the edit button.

Tentative NumPy Tutorial -

You will need to create a User Account first. Before reading this tutorial you should know a bit of Python. If you would like to refresh your memory, take a look at the Python tutorial. If you wish to work the examples in this tutorial, you must also have some software installed on your computer. Minimally: These you may find useful: ipython is an enhanced interactive Python shell which is very convenient for exploring NumPy's features matplotlib will enable you to plot graphics SciPy provides a lot of scientific routines that work on top of NumPy NumPy's main object is the homogeneous multidimensional array. For example, the coordinates of a point in 3D space [1, 2, 1] is an array of rank 1, because it has one axis.

Numpy's array class is called ndarray. Ndarray.ndim the number of axes (dimensions) of the array. Matplotlib: python plotting — Matplotlib v1.0.1 documentation. 1. Extending Python with C or C++ — Python v2.7.2 documentation. It is quite easy to add new built-in modules to Python, if you know how to program in C.

1. Extending Python with C or C++ — Python v2.7.2 documentation

Such extension modules can do two things that can’t be done directly in Python: they can implement new built-in object types, and they can call C library functions and system calls. To support extensions, the Python API (Application Programmers Interface) defines a set of functions, macros and variables that provide access to most aspects of the Python run-time system. The Python API is incorporated in a C source file by including the header "Python.h". The compilation of an extension module depends on its intended use as well as on your system setup; details are given in later chapters.

Do note that if your use case is calling C library functions or system calls, you should consider using the ctypes module rather than writing custom C code. SciKits - scikits. Boa Constructor home. Nullege: A Search Engine for Python source code.