Python on the RDP

From edegan.com
Revision as of 13:42, 21 November 2017 by OliverC (talk | contribs) (Created page with "There are two production versions of Python: Python 2 and Python 3. * You can run scripts written for 3 with 2 if you import the special package [https://docs.python.org/2/li...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There are two production versions of Python: Python 2 and Python 3.

  • You can run scripts written for 3 with 2 if you import the special package __future__
  • You can run scripts written for 2 with 3 if you run the script 2to3
  • All new code should be written in Python 3 for library support and maintainability reasons. If for no other reason know that it uses UTF-8 as the default encoding and so it makes your life easier in every possible way.

Installation

Many Python modules are actually 90% low-level C code with the remaining 10% a python wrapper. That means to install these modules (e.g. numpy, scipy, hdf) you need to have all of the development libraries and compiler tools to compile the C stuff. Enter Anaconda, a widely used repackaging of Python for Windows that comes with most of the libraries you'll ever need. In addition, they've made it easy to have two installs of Python running at once.

  • Python2
    • Python 2.7.14 via Anaconda2 5.0.1 for 64-bit
    • Located at C:\ProgramData\Anaconda2*
  • Python3
    • Python 3.6.3 via Anaconda3 5.0.1 for 64-bit
    • Located at C:\ProgramData\Anaconda3*

* Note that Anaconda is not installed in C:\Program Files\AnacondaN intentionally. Spaces in the path lead to a bunch of unpredictable errors.