Changes

Jump to navigation Jump to search
m
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 ===
+
==Upgrade from 2.7 to 3.7==
Computer --> Properties --> Advanced settings --> Environment Variables.
+
Since Python version 2.7 has reached end of life since January first 2020, this version is no longer installed on our [[System Image]]. Standard is now: Python 3.7 64-bits.
+
If you still have scripts written in Python2, the scripts should be upgraded to Python 3. Most changes are probably the print statements. Print statements should always have parentheses: print('some text')
Add the following Path:
+
Key differences between Python 2 and Python 3 are here: https://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
  −
C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
     −
=== Windows Installation PIP package manager ===
+
For our previous documentation for Python 2.7, see [[Python/Legacy]]
   −
Install Pip by executing get-pip.py you can get the file here: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
+
==Psychopy==
 
+
{{see also|Psychopy}}
Execute the following command:
+
Psychopy 2020.2.10 has been installed in the root of the Python3.7 64-bit version. This is also the default version when 'psychopy' is typed from the command prompt. It is also the default that opens when a .py file is double-clicked. It also can be started by clicking the appropriate icon on the desktop.
 
+
There is also a Psychopy 2020.2.10 installed on Python3.6 32-bits. This version has its own icon on the desktop and should be used when you are using a [[Tobii Eye Tracker]].
Python get-pip.py
+
 
+
When your script fails to load in Psychopy, because you need packages that are not installed on our lab computers, please contact TSG.
=== Windows Installation Setup-Tools (easy_install) ===
  −
 
  −
Execute the command within CMD:
  −
pip install -U setuptools
  −
 
  −
=== 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 ===
+
== Usage ==
   −
Python TestArgs.py
+
===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:
   −
You will see the following result:
+
<syntaxhighlight lang="python" overflow:auto;">
 +
number of argument:  2
 +
argv[0]: ./testArgs.py
 +
argv[1]: a
 +
</syntaxhighlight>
   −
number of argument:  2
+
==See Also==
  argv[0]: ./testArgs.py
+
*[[Psychopy]]
  argv[1]: a
+
*[[Workshop: Python for social scientists]]
 +
<!--
 +
==References==
 +
<references /> -->
   −
= Linux Installation =
+
==External Links==
 +
*{{Official website|http://www.python.org}}

Navigation menu