Difference between revisions of "Python"
Line 1: | Line 1: | ||
− | + | {{Infobox software | |
+ | | name = Software name | ||
+ | | logo = Python-logo-notext.svg | ||
+ | | screenshot = python-logo-master-v3-TM.png | ||
+ | | caption = | ||
+ | | developer = | ||
+ | | released = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} --> | ||
+ | | discontinued = | ||
+ | | latest release version = | ||
+ | | latest release date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} --> | ||
+ | | latest preview version = | ||
+ | | latest preview date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} --> | ||
+ | | installed version = 2.7 | ||
+ | | installed version date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} --> | ||
+ | | status = Active | ||
+ | | programming language = Python | ||
+ | | operating system = | ||
+ | | platform = | ||
+ | | website = [http://www.python.org python.org] | ||
+ | | resources = | ||
+ | {{Infobox tsg | ||
+ | | child = yes | ||
+ | | downloads = {{bulleted list | ||
+ | | [http://www.ru.nl Some Download link] | ||
+ | }} | ||
+ | | manuals = {{bulleted list | ||
+ | | [http://www.ru.nl Quick start guide] | ||
+ | }} | ||
+ | }} | ||
+ | }} | ||
− | + | [[wikipedia:Python_(programming_language)|Python]] is a general-purpose, high-level programming language. | |
− | + | <!-- Table of Contents will be generated here --> | |
− | + | ==Installation== | |
− | |||
− | === | + | ===Windows (32 bit)=== |
− | + | # Download the [https://www.python.org/downloads/ Win32 installer] | |
− | + | # Double-click on the executable and follow the steps on your screen. | |
+ | |||
+ | ==Configuration== | ||
+ | === Windows Environment Variables === | ||
+ | <pre>Computer --> Properties --> Advanced settings --> Environment Variables.</pre> | ||
− | [[image:python_env.jpg | + | [[image:python_env.jpg]] |
Add the following Path: | Add the following Path: | ||
− | + | <pre>C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;</pre> | |
− | [[image:python_path.jpg | + | [[image:python_path.jpg]] |
− | [[image:python_path2.jpg | + | [[image:python_path2.jpg]] |
− | === | + | ===Package Management=== |
+ | After Python is installed, you can use [[wikipedia:Pip_(package_manager)|pip]] to install your required side packages. pip is included with Python 2.7.9. For older versions, use the following steps to install: | ||
− | + | # Download [https://raw.github.com/pypa/pip/master/contrib/get-pip.py get-pip.py] | |
+ | # Execute get-pip by entering the following command: <code style="background-color:#000; color:#fff; padding:1px 3px;">python get-pip.py</code> | ||
− | + | To install a side package, simply execute the following command: <code style="background-color:#000; color:#fff; padding:1px 3px;">c:\pip install PACKAGE_NAME</code><br/> | |
+ | Replace PACKAGE_NAME with the name of the package of choice. | ||
− | + | '''Note:''' By default, side packages are installed in the following folder (Windows): | |
+ | <pre>C:\Python27\Lib\site-packages</pre> | ||
+ | This location may differ if you have installed Python somewhere else. | ||
− | + | ||
+ | ===List of Side Packages=== | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
− | ! | + | ! Python Library |
− | ! | + | ! Description |
− | ! | + | ! Installed |
− | ! | + | ! Installer Type |
− | ! | + | ! URL |
|- | |- | ||
Line 80: | Line 118: | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | === Setup-Tools === | |
− | + | To install setup-tools, execute the following command in CMD: <code style="background-color:#000; color:#fff; padding:1px 3px;">pip install -U setuptools</code> | |
− | |||
− | |||
− | |||
− | |||
− | |||
=== Windows Handlers === | === Windows Handlers === | ||
− | |||
Check the Handlers by opening the Windows registry editor. | Check the Handlers by opening the Windows registry editor. | ||
− | |||
<syntaxhighlight lang="reg" overflow:auto;"> | <syntaxhighlight lang="reg" overflow:auto;"> | ||
Line 120: | Line 144: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
=== Python DLL Files === | === Python DLL Files === | ||
Line 128: | Line 153: | ||
* '''C:\Windows\SysWOW64''' | * '''C:\Windows\SysWOW64''' | ||
− | == | + | == Usage == |
− | + | ===Example: TestArgs.py=== | |
− | Execute the following script within the commandline: | + | Execute the following script within the commandline (CMD): <code style="background-color:#000; color:#fff; padding:1px 3px;">python testArgs.py a.</code> |
− | + | You should see the following result: | |
− | <code style="background-color:#000; color:#fff; padding:1px 3px;">python testArgs.py a.</code> | ||
− | |||
− | |||
− | You | ||
<syntaxhighlight lang="matlab" overflow:auto;"> | <syntaxhighlight lang="matlab" overflow:auto;"> | ||
Line 143: | Line 164: | ||
argv[1]: a | argv[1]: a | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | ==See Also== <!-- Optional --> | ||
+ | *[[Psychopy]] | ||
+ | |||
+ | <!-- | ||
+ | ==References== | ||
+ | <references /> | ||
+ | --> | ||
+ | |||
+ | ==External Links== | ||
+ | *{{Official website|http://www.python.org}} |
Revision as of 13:04, 6 August 2015
300px | |||||||||
Installed version | 2.7 | ||||||||
---|---|---|---|---|---|---|---|---|---|
Development status | Active | ||||||||
Written in | Python | ||||||||
Website | python.org | ||||||||
|
Python is a general-purpose, high-level programming language.
Installation
Windows (32 bit)
- Download the Win32 installer
- Double-click on the executable and follow the steps on your screen.
Configuration
Windows Environment Variables
Computer --> Properties --> Advanced settings --> Environment Variables.
Add the following Path:
C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
Package Management
After Python is installed, you can use pip to install your required side packages. pip is included with Python 2.7.9. For older versions, use the following steps to install:
- Download get-pip.py
- Execute get-pip by entering the following command:
python get-pip.py
To install a side package, simply execute the following command: c:\pip install PACKAGE_NAME
Replace PACKAGE_NAME with the name of the package of choice.
Note: By default, side packages are installed in the following folder (Windows):
C:\Python27\Lib\site-packages
This location may differ if you have installed Python somewhere else.
List of Side Packages
Python Library | Description | Installed | Installer Type | URL |
---|---|---|---|---|
PIL | Python Image Library | Yes | Package Manager | http://www.pythonware.com/products/pil/ |
SciPy | Python-based ecosystem of open-source software for mathematics, science, and engineering. | Yes | Package Manager | http://www.scipy.org/install.html |
PyWin32 | Python Extensions for Windows | Yes | Windows Installer | http://sourceforge.net/projects/pywin32/files/pywin32/ |
PySerial | Serial access for Python | Yes | Windows Installer | https://pypi.python.org/pypi/pyserial |
wxPython | GUI Toolkit for Python | Yes | Windows Installer | http://www.wxpython.org/download.php#msw |
matplotlib | 2D plotting library for Python | Yes | Windows Installer | http://matplotlib.org/downloads.html |
pyo | dedicated Python module for digital signal processing | Yes | Windows Installer | http://ajaxsoundstudio.com/software/pyo/ |
Opencv2 | Open Source Computer Vision is a library of programming functions mainly aimed at real-time computer vision | Yes | Windows Installer | http://opencv.org/ |
PyQt | Python binding of the cross-platform GUI toolkit Qt | Yes | Windows Installer | http://www.riverbankcomputing.co.uk/software/pyqt/download5 |
PyQtGraph | Scientific Graphics and GUI Library for Python | Yes | Windows Installer | http://www.pyqtgraph.org/ |
LXML | library for processing XML and HTML in the Python language | Yes | Package Manager | http://lxml.de/ |
PyGame | Pygame is a set of Python modules designed for writing games. | Yes | Windows installer | http://pygame.org/news.html |
PANDAS | Python Data Analysis Library | Yes | Package Manager | http://pandas.pydata.org/ |
Expyriment | A Python library for congnitive and neuroscientific experiments. | Yes | Package Manager | http://www.expyriment.org/ |
Pyparse | Parse text files in an easier and more maintainable manner | Yes | Package Manager | https://pypi.python.org/pypi/PyParse/1.1.7 |
AVbin | media decoding/decompression library | Yes | Windows Installer | https://code.google.com/p/avbin/ |
Pyglet | a cross-platform windowing and multimedia library for Python. | Yes | Manual Install | File:Pyglet-1.1.4.zip |
FreeType | Library to Render Fonts | Yes | Manual Install | File:Freetype.zip |
Psychopy | Psychology Software in Python | Yes | Package Manager | http://www.psychopy.org |
Setup-Tools
To install setup-tools, execute the following command in CMD: pip install -U setuptools
Windows Handlers
Check the Handlers by opening the Windows registry editor.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Python.CompiledFile\shell\open\command]
@="\"C:\\Python27\\python.exe\" \"%1\" %*"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Python.File\shell\open\command]
@="\"C:\\Python27\\python.exe\" \"%1\" %*"
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Python.CompiledFile\shell\open\command]
@="\"C:\\Python27\\python.exe\" \"%1\" %*"
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Python.File\shell\open\command]
@="\"C:\\Python27\\python.exe\" \"%1\" %*"
Python DLL Files
- C:\Python27\DLLs\
- Path Within the script.
- C:\Windows\System32 or
- C:\Windows\SysWOW64
Usage
Example: TestArgs.py
Execute the following script within the commandline (CMD): python testArgs.py a.
You should see the following result:
number of argument: 2
argv[0]: ./testArgs.py
argv[1]: a
See Also