I would like to run an external code, written in Fortran, C++, or Python, within Wolfram Mathematica 12 on my MAC OS. I looked up on Internet and I tried to read the WSTP documentation on Wolfram Mathematica, but I still was not able to solve my issue. Could you please provide me some examples explained step by step in order that I can understand the strategy and I can then implement to there external codes? Thanks for your help.


You must first configure MMA to use Python. Here is how to proceed, from the help (version 12.1):


If you have done the setup, you can execute Python code inside a Notebook. You may e.g. type ">" (Greater) at the beginning of a line. This gives you a Python code cell, where you can type and execute Python code. E.g.:

enter image description here

Or you may create a Python session, using ExternalEvaluate as described in the help:



Not the answer you're looking for? Browse other questions tagged or ask your own question.