Ceci est une ancienne révision du document !
Langage de programmation Python
Python est un langage de programmation interprété, orienté objet, dont l'utilisation va des scripts systèmes aux applications web. Il est placé sous une licence libre proche de la licence BSD et fonctionne sur la plupart des plateformes.
Programmer en Python
Pour plus d'information sur la programmation en Python, référez-vous au portail Programmation. Par défaut, Python est installé sur GNU/Linux. Sous Ubuntu par exemple, saisir "python" dans un terminal pour avoir accès à l'invite de commande Python. Pour connaître votre version de Python installé, tapez "python -V" dans le terminal.
Logiciel éditeur Python (IDE)
Les logiciels pour éditer des scripts python :
Nom | Cross Platform | Commercial ou Free | Auto Code Completion | Multi-Language Support | Integrated Python Debugging | Error Markup | Source Control Integration | Smart Indent | Bracket Matching | Line Numbering | UML Editing or Viewing | Code Folding | Code Templates | Unit Testing | GUI Designer | Integrated DB Support | Rapid Application Development | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Nom | CP | C/F | AC | MLS | PD | EM | SC | SI | BM | LN | UML | CF | CT | UT | UID | DB | RAD | comments |
BlackAdder | Y | C | Y | Y | ||||||||||||||
BlueFish | L | |||||||||||||||||
Boa Constructor | Y | F | Y | Y | Y | Y | Y | Y | Y | Y | Y | |||||||
ConTEXT | W | C | ||||||||||||||||
DABO | Y | |||||||||||||||||
DreamPie | F | |||||||||||||||||
Dr.Python | F | Y | ||||||||||||||||
Editra | Y | F | Y | Y | Y | Y | Y | Y | Y | |||||||||
Emacs | Y | F | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | ||||
Eric Ide | Y | F | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y¹ | Y² | ¹QtDesigner ²Navigateur SQL intégré | |
E-Texteditor | W | |||||||||||||||||
Geany | Y | F | Y* | Y | Y | Y | Y | Y | * very limited | |||||||||
Gedit | Y | F | Y¹ | Y | Y | Y | Y | Y² | ¹ with plugin ² sort of | |||||||||
Idle | Y | F | Y | |||||||||||||||
JEdit | Y | F | Y | Y | Y | Y | ||||||||||||
KDevelop | Y | F | Y | Y | Y | Y | Y | Y | ||||||||||
Nom | CP | C/F | AC | MLS | PD | EM | SC | SI | BM | LN | UML | CF | CT | UT | UID | DB | RAD | comments |
Komodo | Y | C/F | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | ||||
NetBeans | Y | F | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | ||||
NotePad++ | W | F | Y | Y | ||||||||||||||
Pfaide | W | C | Y | Y | Y | Y | Y | Y | Y | |||||||||
PIDA | LW | F | Y | Y | Y | Y | Y | Y | ||||||||||
PTVS | W | F | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y* | Y | |||||
PyCharm | Y | C | Y | Y* | Y | Y | Y | Y | Y | Y | Y | |||||||
PyDev(Eclipse) | Y | F | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | ||||
Pyscripter | W | F | Y | Y | Y | Y | Y | Y | Y | |||||||||
PythonWin | W | F | Y | Y | Y | Y | Y | |||||||||||
SciTE | Y | F | Y | Y | Y | Y | Y | Y | ||||||||||
ScriptDev | W | C | Y | Y | Y | Y | Y | Y | Y | Y | Y | |||||||
SPE | F | Y | Y | |||||||||||||||
Spyder/spyderlib | Y | F | Y | Y | Y | Y | Y | Y | ||||||||||
Sublime Text | Y | C | Y | Y | Y | Y | Y | Y | ||||||||||
TextMate | M | Y | Y | Y | Y | Y | Y | |||||||||||
UliPad | Y | F | Y | Y | Y | Y | Y | Y | Y | |||||||||
Vim | Y | F | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | |||||
WingIde | Y | C | Y | Y* | Y | Y | Y | Y | Y | Y | Y | Y | Y | |||||
Zeus | W | C | Y | Y | Y | Y | Y | Y | ||||||||||
Nom | CP | C/F | AC | MLS | PD | EM | SC | SI | BM | LN | UML | CF | CT | UT | UID | DB | RAD | comments |
Acronymes:
- CP - Cross Platform
- C - Commercial
- F - Free
- AC - Automatic Code-completion
- MLS - Multi-Language Support
- PD - Integrated Python Debugging
- EM - ErrorMarkup
- SC - Source Control integration
- SI - Smart Indent
- BM - Bracket Matching
- LN - Line Numbering
- UML - UML editing / viewing
- CF - Code Folding
- CT - Code Templates
- UT - Unit Testing
- UID - GUI Designer (for example, Qt, Eric, ..)
- DB - integrated database support
- RAD - Rapid application development support
- L - Linux
- W - Windows
- M - Mac
Logiciels de création d'interface graphique
Les logiciels pour créer des interfaces graphiques pour python:
- QT Creator pour des interfaces en QT
Installation
Python 2
Python 2 est installé par défaut, il suffit de taper python
dans un terminal pour accéder à l'interpréteur.
Python 3 et Ubuntu
Ubuntu 16.04 (et 14.04)
La dernière version (3.6) n'est pas dans les dépots de la dernière LTS 16.04 (ni de la précédente 14.04) . La version 3.6 apporte des différences significatives par rapport à la version précédente (entre autres avec les F String) et peut être nécessaire.
Pour installer Python 3.6 avec Ubuntu 16.04, il faut ajouter un ppa :
- soit
jonathonf/python-3.6
- soit
deadsnakes/ppa
Puis on installe Python 3.6.
Les commandes complètes avec, par exemple, jonathon ppa :
$ sudo add-apt-repository ppa:jonathonf/python-3.6 $ sudo apt update $ sudo apt install python3.6
Pour invoquer l'interpréteur, il faut taper python3
ou python3.6
!
Ubuntu 16.10, 17.04, 17.10
Pour Ubuntu 16.10 et 17.04, Python 3.6 est packagé dans le dépôt universe, donc s'il est actif, il suffit de taper :
$ sudo apt install python3.6
Ubuntu 17.10 est livré avec Python 3.6, il suffit de taper python3
pour l'invoquer.
IDLE 3.6
Pour installer IDLE en version Python 3.6 (si on a déjà installé Python en 3.6), il suffit d'installer idle-python3.6
.
iPython
Voici les instructions pour installer iPython (dans une version récente) sous 16.04, avec pip
:
(la première ligne installe pip3)
$ sudo apt install python3-pip $ pip3 install --upgrade pip $ sudo pip3 install jupyter $ sudo pip3 install ipython
Logiciels liés à Python
Voici la liste des pages de la documentation présentant les logiciels liés au langage Python :