Updated Python Tips

Stephen Y.F. Wang

2017-01-07


 

Install

Two options in Windows, one is the official version, another is the scientific-oriented Python Distribution, such as ActivePython, Anaconda, Python(x,y), Pyzo, WinPython, etc..

Install the Official Version

Install Anaconda

Anaconda is a enterprise-ready Python distribution for big data.

  1. The installation of Anaconda on Windows is as simple as other regular Windows programs, just download the binary from https://www.continuum.io/downloads (I use Python 2.7), then install it.
  2. Commands for managing packages:

    conda install XXX
    conda update XXX
    conda update anaconda
    conda remove XXX
    conda clean -a
  3. If want use GNU Compiler to build Python Extensions, you should:
    1. Install the libpython package provided by Anaconda: conda install libpython
    2. Create a file named distutils.cfg in path2anaconda\Lib\distutils with contents:

      [build]
      compiler=mingw32
      

Scientific Libraries

Autograd: Efficiently Computes Derivatives of Numpy Code

  1. Installation: First check the dependencies, especially the version of Numpy, then the usual pip install autograd.
  2. Usage:

Numdifftools: Solves Automatic Numerical Differentiation Problems

  1. Installation: First check the dependence, especially those for Algopy, then the usual pip install numdifftools.
  2. Usage:

Openopt: A Python Module for Numerical Optimization

  1. Dependency: setproctitle, it is a C extension, can download the whl file from Christoph Gohlke’s website
  2. Install:

    easy_install openopt
    easy_install FuncDesigner
    easy_install DerApproximator