Difference between revisions of "Python"

From TSG Doc
Jump to navigation Jump to search
 
(142 intermediate revisions by 5 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==
Computer --> Properties --> Advanced settings --> Environment Variables.
+
{{see |Psychopy}}
 
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>
  
=== Windows Installation Setup-Tools (easy_install) ===
+
==See Also==
 +
*[[Psychopy]]
 +
*[[Workshop: Python for social scientists]]
 +
<!--
 +
==References==
 +
<references /> -->
  
Execute the command within CMD:
+
==External Links==  
pip install -U setuptools
+
*{{Official website|http://www.python.org}}
 
 
=== Check 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 ===
 
 
 
Python TestArgs.py
 
 
 
You will see the following result:
 
 
 
...
 
 
 
= Linux Installation =
 

Latest revision as of 15: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