Changes

Jump to navigation Jump to search
2,340 bytes added ,  15:43, 29 March 2019
no edit summary
'''THIS PAGE APPLIES TO THE OLD RDP SERVER, NOT THE NEW AND CURRENT ONE'''
 
There are two production versions of Python: Python 2 and Python 3.
<nowiki>*</nowiki> Note that Anaconda is not installed in <code>C:\Program Files\AnacondaN</code> intentionally. Spaces in the path lead to a bunch of unpredictable errors.
 
=== Manually Defining Explicit Python Binary Executables ===
 
A common practice is to have a bunch of specific Python commands to force explicit behavior. For example on Ubuntu, you can choose from running python, python2, python 2.6, python2.7, python3, python3.5, etc in the shell. To emulate this behavior, copy and paste the <code>python.exe</code> and rename it to <code>pythonN.exe</code> where N is whatever specific version you copied. The same applies to scripts you want to use like <code>pip</code>: copy-and-paste the file to a more explicit name.
 
Path is evaluated with the first entries taking precedence. Thus, whichever version of Python you want to be the default should be listed at the leftmost position on the string. You can also just delete the unregistered python.exe to achieve the same result.
 
=== ArcMap Aside ===
 
Note that by default, ESRI ArcMap maintains a separate Python 2 installation at <code>C:\Python27</code>. Just ignore this...it is not to be used for development or as the environment for running programs other than ArcMap.
 
== Simultaneously Registering Python 2 and 3 ==
 
Anaconda automatically "registers" the separate installations for use with some development environments. It does not (by default) add executables to the Path system environment. We will add the base <code>AnacondaN/*</code> files and <code>AnacondaN/Scripts/*</code> to the path as so:
 
# Right-click on the Windows icon in the bottom left
# Select System
# Select Advanced System Settings (must be administrator)
# Select the Advanced Tab
# Select "Environment Variables..." at the bottom right
# Add semicolon-separated directories to Path in the lower box labeled System Variables
 
See [http://mcnair.bakerinstitute.org/wiki/File:Path-example.PNG File:Path-example.PNG] for an example.
 
== Explicitly Running a Specific Python Version ==
 
All of these are valid ways to run Python on the RDP:
 
* <code>python</code>
* <code>python2</code>
* <code>python3</code>
 
By default, running <code>python</code> will run Python 2. '''This behavior should not be relied on.''' On most other systems, Python 3 is the default instead.
 
It is the same case with <code>pip</code> which can be run via <code>pip</code>, <code>pip2</code>, <code>pip3</code>

Navigation menu