# Run python code from a mathematica notebook? (Mac OS)

**URL:** <https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533>\
**Category:** Questions\
**Tags:** mathematica, external-interfaces, computational-notebooks\
**Created:** [January 12, 2019, 11:47am UTC](https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533 "2019-01-12T11:47:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![libertyaskew](https://avatars.discourse-cdn.com/v4/letter/l/a88e4f/32.png) [@libertyaskew](https://community.wolfram.com/u/libertyaskew)\
**Post date:** [January 12, 2019, 11:47am UTC](https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533/1 "2019-01-12T11:47:48Z")

</div>

Hi,

I am trying to run python code in Mathematica. Ideally, I would like to use Mathematica’s algebraic facilities to rearrange values in my python functions. However I am having problems starting an external session. I already have python installed. I have been following the documentation

> **[Configure Python for ExternalEvaluate—Wolfram Documentation](https://reference.wolfram.com/language/workflow/ConfigurePythonForExternalEvaluate.html)**
>
> Configure your system to evaluate external Python code.

 ![ScreenShot2019-01-12at11.45.42.png](https://global.discourse-cdn.com/wolfram/original/3X/b/e/be328331b83a1f050f8410568a5103eea5ea8aa6.png)

If someone could let me know where I am going wrong, see screenshot, that would be great!  
[1]: [https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-01-12at11.45.42.png&userId=1587970](https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-01-12at11.45.42.png&userId=1587970)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![libertyaskew](https://avatars.discourse-cdn.com/v4/letter/l/a88e4f/32.png) [@libertyaskew](https://community.wolfram.com/u/libertyaskew)\
**Post date:** [January 12, 2019, 11:49am UTC](https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533/2 "2019-01-12T11:49:48Z")

</div>

I should add, this is on a MAC

---

<div class="post-metadata">

**Author:** ![murray](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/murray/32/39879_2.png) [@murray](https://community.wolfram.com/u/murray)\
**Post date:** [January 12, 2019, 4:13pm UTC](https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533/3 "2019-01-12T16:13:16Z")

</div>

This does not seem to be a _Mathematica_ issue _per se_: _Mathematica_ is not finding any Python installation (as shown by the output when you evaluate `FindExternalEvaluators["Python"]`), and hence _not_ a problem with `ExternalEvaluate`.

Can you run Python from the command line in Terminal?

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [January 12, 2019, 10:45pm UTC](https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533/4 "2019-01-12T22:45:50Z")

</div>

Looks like you are trying to run `pip` from a Mathematica notebook. It needs to be run from a shell. On a Mac start the terminal app, `Command-space`, then type `Terminal` and return. In the terminal window type `python` to make sure Python is installed. Then `pip install pyzmq`. Then in a notebook try `FindExternalEvaluators["Python"]`.

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [January 14, 2019, 3:58pm UTC](https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533/5 "2019-01-14T15:58:44Z")

</div>

Welcome to Wolfram Community! Please make sure you know the rules: [https://wolfr.am/READ-1ST](https://wolfr.am/READ-1ST)

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please **EDIT** your post and make sure code blocks start on a new paragraph and look framed and colored like this.

```
int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

```

 ![ScreenShot2017-04-28at9.43.33AM.png](https://global.discourse-cdn.com/wolfram/original/3X/f/3/f3367c082cbad32b79855f70628ea173f845653e.png)

---

<div class="post-metadata">

**Author:** ![anon\_91240867](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon\_91240867](https://community.wolfram.com/u/anon_91240867)\
**Post date:** [January 17, 2019, 8:32pm UTC](https://community.wolfram.com/t/run-python-code-from-a-mathematica-notebook-mac-os/13533/6 "2019-01-17T20:32:42Z")

</div>

you could run Awk, bash or if you want “a front end” or use apple’s awesome applescript or cocoa (script you can do things like touch-screen with not just boxes)

unsure why you’d pick python on apple. but your choice!
