Configure your system to evaluate external Python code.

For Mac...

Install the Python package manager

The Python package manager, pip, is necessary to install the ZMQ sockets package for communication with the Python evaluator. You can test if pip is available on your system by evaluating in a terminal:

$ pip --version

If you get a message such as command not found, you need to install pip:

$ sudo easy_install pip
  • Python is already installed on Mac systems, so no further installation is necessary. If you want to install other versions of Python, download the appropriate installer from http://python.org, double-click the resulting .pkg file, and follow the instructions.

Install the pyzmq package for Python

Install the pyzmq package for communicating with Python using ZMQ sockets:

$ pip install pyzmq

Verify the installation

If the installation was successful, FindExternalEvaluators will discover it automatically:

In[1]:=
Click for copyable input
Out[1]=

Evaluate Python code

Use the Python installation to evaluate Python code:

Out[2]=

For Windows...

Install Python

Download the Python installer at http://python.org and open the resulting .exe installer file.

Install the Python package manager

The Python package manager, pip, is necessary to install the zmq sockets package for communication with the Python evaluator. You can test if pip is available on your system by evaluating in a terminal:

> pip.exe --version

If you get a message such as command not found, you need to install pip:

> easy_install.exe pip

Install the pyzmq package for Python

Install the pyzmq package for communicating with Python using ZMQ sockets:

> pip.exe install pyzmq

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

In[3]:=
Click for copyable input
Out[3]=

Note that there may be multiple evaluators that appear for each different form of the Python executable, but that all use the same installation of Python. This is normal.

Evaluate Python code

Use the Python installation to evaluate Python code:

Out[4]=

For Linux...

Install Python for Linux

Python comes pre-installed on some Linux distributions. You can test if your system has Python available by evaluating in a terminal:

$ python --version

If you get a message such as "command not found", you need to install Python either by using a package repository tool on your system or by downloading the Python installer at http://python.org and uncompressing the resulting tarball.

On Ubuntu-based systems with the APT package repository, Python can be installed with:

$ sudo apt-get update && sudo apt-get install -y python

On Fedora or Red Hat systems with the yum package repository, Python can be installed with:

$ sudo yum install -y python

Install the Python package manager

The Python package manager, pip, is necessary to install the zmq sockets package for communication with the Python evaluator. You can test if pip is available on your system by evaluating in a terminal:

$ pip --version

If you get a message such as command not found, you need to install pip:

$ sudo easy_install pip

Install pyzmq package for Python

Install the pyzmq package for communicating with Python using ZMQ sockets:

$ pip install pyzmq

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

In[5]:=
Click for copyable input
Out[5]=

Evaluate Python code

Use the Python installation to evaluate Python code:

Out[6]=
Notes
If you have installed Python according to the steps above, but it is not discovered by FindExternalEvaluators, you can register it manually with RegisterExternalEvaluator; for example:
In[7]:=
Click for copyable input
Out[7]=