Difference between revisions of "Python"

From TSG Doc
Jump to navigation Jump to search
 
(114 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Windows Installation =
+
{{Infobox software
 +
| name                  = Python
 +
| logo                  = Python-logo-generic.svg
 +
| logo size              = 180px
 +
| logo alt              = Python(tm)
 +
| 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      = 3.7.9 64-bits
 +
| 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
 +
  | header2 = Workshop
 +
  | data2 = {{bulleted list
 +
      | [[Workshop: Python for behavioural scientists|Python for behavioural scientists]]
 +
  }}
 +
}} 
 +
}}
  
=== Windows Installation Python 2.7 ===
+
[[wikipedia:Python_(programming_language)|Python]] is a general-purpose, high-level programming language. It is also a [[wikipedia:Python_%28genus%29|type of snake]] and a [[wikipedia:Python_%28Efteling%29|rollercoaster]], but one is arguably more relevant to your research than the others. <br/>
 +
On the lab computers, there is support for Spyder, PyCharm and [[Psychopy]].  
  
You can download the '''''Win32''''' installer by clicking on the following link:
+
<!-- Table of Contents will be generated here -->
https://www.python.org/downloads/
 
  
=== Set Windows Environment Variables ===
+
==Psychopy==
+
{{see |Psychopy}}
Computer --> Properties --> Advanced settings --> Environment Variables.
 
Add the following Path:
 
 
C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
 
  
=== Windows Installation PIP package manager ===
+
When your script fails to load in Psychopy, because you need packages that are not installed on our lab computers, please contact TSG.
  
Install Pip by executing get-pip.py you can get the file here: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
+
== Usage ==
  
Execute the following command:
+
===Example: TestArgs.py===
 +
Execute the following script within the commandline (CMD): <code style="background-color:#000; color:#fff; padding:1px 3px;">python testArgs.py a.</code><br/>
 +
You should see the following result:
  
  python get-pip.py
+
<syntaxhighlight lang="python" overflow:auto;">
 +
number of argument: 2
 +
argv[0]: ./testArgs.py
 +
argv[1]: a
 +
</syntaxhighlight>
  
{| class="wikitable"
+
==See Also==
|-
+
*[[Psychopy]]
! scope="col" | Python Library 
+
*[[Workshop: Python for social scientists]]
! scope="col" | Description
+
<!--
! scope="col" | Installed
+
==References==
! scope="col" | Installer Type
+
<references /> -->
! scope="col" | URL
 
  
|-
+
==External Links==  
| PIL || Python Image Library || style="background-color:#9F9;" | Yes || Package Manager || http://www.pythonware.com/products/pil/ 
+
*{{Official website|http://www.python.org}}
|-
 
| SciPy || Python-based ecosystem of open-source software for mathematics, science, and engineering. || style="background-color:#9F9;" | Yes || Package Manager || http://www.scipy.org/install.html
 
|-
 
| PyWin32 || Python Extensions for Windows || style="background-color:#9F9;" | Yes || Windows Installer || http://sourceforge.net/projects/pywin32/files/pywin32/
 
|-
 
| PySerial || Serial access for Python || style="background-color:#9F9;" | Yes || Windows Installer || https://pypi.python.org/pypi/pyserial
 
|-
 
| wxPython || GUI Toolkit for Python || style="background-color:#9F9;" | Yes || Windows Installer || http://www.wxpython.org/download.php#msw
 
|-
 
| matplotlib || 2D plotting library for Python || style="background-color:#9F9;" | Yes || Windows Installer  || http://matplotlib.org/downloads.html
 
|-
 
| pyo || dedicated Python module for digital signal processing || style="background-color:#9F9;" | 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 || style="background-color:#9F9;" | Yes || Windows Installer || http://opencv.org/
 
|-
 
| PyQt ||  Python binding of the cross-platform GUI toolkit Qt || style="background-color:#9F9;" | Yes || Windows Installer || http://www.riverbankcomputing.co.uk/software/pyqt/download5
 
|-
 
| PyQtGraph || Scientific Graphics and GUI Library for Python || style="background-color:#9F9;" | Yes || Windows Installer || http://www.pyqtgraph.org/
 
|-
 
| LXML || || style="background-color:#9F9;" | Yes  || ||
 
|-
 
| PyGame || || style="background-color:#9F9;" | Yes  || ||
 
|-
 
| PANDAS || || style="background-color:#9F9;" | Yes  || ||
 
|-
 
| Expyrment || || style="background-color:#9F9;" | Yes  || ||
 
| AVbin || Codec || style="background-color:#9F9;" | Yes || Windows Installer || http://avbin.github.io/AVbin/Home/Home.html
 
|}
 
 
 
'''Example'''
 
 
 
c:\pip install SciPy
 
 
 
'''Default Folder Location packages'''
 
 
 
The librarys is installed on the following windows path:
 
C:\Python27\Lib\site-packages
 
 
 
=== Windows Installation Setup-Tools (easy_install) ===
 
 
 
Execute the command within 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\" %*"
 
 
 
=== Execute Python TestArgs.py ===
 
 
 
Execute the following script within the commandline:
 
 
 
python testArgs.py a.
 
 
 
You will see the following result:
 
 
 
number of argument:  2
 
  argv[0]: ./testArgs.py
 
  argv[1]: a
 

Latest revision as of 16:42, 23 April 2024

Python
Python(tm)
Installed version3.7.9 64-bits
Development statusActive
Written inPython
Websitepython.org

Python is a general-purpose, high-level programming language. It is also a type of snake and a rollercoaster, but one is arguably more relevant to your research than the others.
On the lab computers, there is support for Spyder, PyCharm and Psychopy.


Psychopy

Template:See

When your script fails to load in Psychopy, because you need packages that are not installed on our lab computers, please contact TSG.

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

External Links