# When running Python scripts, how to you set which version of Python is being used?

**URL:** https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810
**Category:** General
**Created:** [28 July 2020 03:28 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810 "2020-07-28T03:28:58Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [28 July 2020 03:28 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/1 "2020-07-28T03:28:58Z")

</div>

Forgetting `pythonshell`, nodes seem to have (or be able to have) python code in them.

How do I know which version of `python` they invoke?

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [28 July 2020 03:46 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/2 "2020-07-28T03:46:44Z")

</div>

To check  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/64bb2ec9192f1aeb965f4f615f1439114c44d4a8.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [28 July 2020 03:50 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/3 "2020-07-28T03:50:37Z")

</div>

AFAICS, (as far as I can see) there is no mention of python being used.

(Just checked.) NO.

No mention.

Now I can't even find the node in the library.

[This one.](https://github.com/erfanjahanshahlo/node-red-contrib-pifacecad)

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [28 July 2020 09:10 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/4 "2020-07-28T09:10:54Z")

</div>

Turns out it is hardcoded for this node.

> <https://github.com/erfanjahanshahlo/node-red-contrib-pifacecad/blob/8457ae3afbcb844e80a3d3cf8d5df5bca698f398/pfc_lcd.js#L8>

This line tells you it will use Python 2.x, likely 2.7 which has been End Of Life since January 1st.

As such, the instructions for installing dependencies are odd:

> [@](#):
>
> For install dependencies, in your raspberry pi terminal run the below command.
> 
> ```auto
> sudo apt-get update
> sudo apt-get upgrade
> sudo apt-get install python{,3}-pifacecad
> 
> ```

That last line will install the pifacecad python library for both python2 and python3, yet hardcoded uses python2.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [28 July 2020 09:27 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/5 "2020-07-28T09:27:37Z")

</div>

Thanks.

So 2.7 should be it.

I shall stick to trying the code with that then.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [28 July 2020 09:39 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/6 "2020-07-28T09:39:23Z")

</div>

@Trying_to_learn - I would open an issue on GitHub pointing out the hard coded version and that it hit EOL

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [29 July 2020 16:32 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/7 "2020-07-29T16:32:54Z")

</div>

To repeat what Lena said - Python 2.x is end of life and will no longer get updates. You really do need to upgrade.

Good spot Lena.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [27 September 2020 16:32 UTC](https://discourse.nodered.org/t/when-running-python-scripts-how-to-you-set-which-version-of-python-is-being-used/30810/8 "2020-09-27T16:32:54Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
