# How to change code runner on vs code from python u to python 3

**URL:** <https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047>\
**Category:** Python\
**Created:** [January 19, 2022, 12:27am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047 "2022-01-19T00:27:19Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobikasaba](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tobikasaba](https://forum.codewithmosh.com/u/tobikasaba)\
**Post date:** [January 19, 2022, 12:27am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/1 "2022-01-19T00:27:19Z")

</div>

Hello, I am starting the python course and I am on a Mac so I need to change the default python code runner from python u to python 3. the tutorial cant be used on the current vscode version. please does anyone know how to change this

---

<div class="post-metadata">

**Author:** ![Mattie123](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Mattie123](https://forum.codewithmosh.com/u/Mattie123)\
**Post date:** [January 23, 2022, 7:10am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/2 "2022-01-23T07:10:52Z")

</div>

I’m also experiencing the same problem on Mac, anyone with any useful information please

---

<div class="post-metadata">

**Author:** ![tobikasaba](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tobikasaba](https://forum.codewithmosh.com/u/tobikasaba)\
**Post date:** [February 8, 2022, 8:58pm UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/3 "2022-02-08T20:58:32Z")

</div>

Hey Mattie. By any chance did you figure this out

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.codewithmosh.com/u/Guest)\
**Post date:** [February 14, 2022, 6:15pm UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/4 "2022-02-14T18:15:11Z")

</div>

Having the same problem on mac. Sublime text uses python3 but cannot get VS Code to recognize it. Homebrew shows Python 3.9.

---

<div class="post-metadata">

**Author:** ![BFX0.9](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@BFX0.9](https://forum.codewithmosh.com/u/BFX0.9)\
**Post date:** [February 15, 2022, 11:01am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/5 "2022-02-15T11:01:19Z")

</div>

In vs code press shift + command + p.  
Search for python interpreter and click on “Python: select interpreter”  
On the top it has an option “Enter interpreter path”. Select that and enter the path to the python version you downloaded and installed on your machine.  
Hope this helps you friends.

---

<div class="post-metadata">

**Author:** ![BFX0.9](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@BFX0.9](https://forum.codewithmosh.com/u/BFX0.9)\
**Post date:** [February 15, 2022, 11:02am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/6 "2022-02-15T11:02:37Z")

</div>

If you still haven’t firgured this out.  
I hope this helps you.

---

<div class="post-metadata">

**Author:** ![mayma](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mayma](https://forum.codewithmosh.com/u/mayma)\
**Post date:** [March 20, 2022, 7:07am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/7 "2022-03-20T07:07:35Z")

</div>

I followed the steps but it’s still showing python -u ☹

---

<div class="post-metadata">

**Author:** ![BFX0.9](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@BFX0.9](https://forum.codewithmosh.com/u/BFX0.9)\
**Post date:** [March 21, 2022, 12:32pm UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/8 "2022-03-21T12:32:20Z")

</div>

Make sure you are entering the correct path to your interpreter .  
In your terminal run “where python3.10” or whichever version you wanna use and copy the path it gives you and paste it in VsCode. When you selected the path restart VsCode.

---

<div class="post-metadata">

**Author:** ![mayma](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mayma](https://forum.codewithmosh.com/u/mayma)\
**Post date:** [March 24, 2022, 6:33am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/9 "2022-03-24T06:33:02Z")

</div>

Thank you for your help but I can’t get the path at terminal. It said invalid syntax ☹

---

<div class="post-metadata">

**Author:** ![BFX0.9](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@BFX0.9](https://forum.codewithmosh.com/u/BFX0.9)\
**Post date:** [March 24, 2022, 12:42pm UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/10 "2022-03-24T12:42:14Z")

</div>

You’re probably running the “where python3” command in the VsCode terminal.  
Your VsCode terminal is probably running python so when you enter the command it tries to run the command as a python code. That’s why it’s saying invalid syntax.  
Make sure it’s not running python or use the your computer’s terminal instead of your project’s terminal to get the path to your interpreter.

---

<div class="post-metadata">

**Author:** ![mayma](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mayma](https://forum.codewithmosh.com/u/mayma)\
**Post date:** [March 24, 2022, 11:48pm UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/11 "2022-03-24T23:48:41Z")

</div>

I got it. Thank you!

---

<div class="post-metadata">

**Author:** ![BFX0.9](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@BFX0.9](https://forum.codewithmosh.com/u/BFX0.9)\
**Post date:** [March 26, 2022, 7:23am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/12 "2022-03-26T07:23:08Z")

</div>

Did you successfully change your python to python3 ?

---

<div class="post-metadata">

**Author:** ![tempuserxx](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@tempuserxx](https://forum.codewithmosh.com/u/tempuserxx)\
**Post date:** [March 31, 2022, 6:21am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/13 "2022-03-31T06:21:55Z")

</div>

When I was clicking on the triangle (run code) it told me: python -u bla bla error  
Then I clicked on the arrow pointing down near this triangle and selected: run python file and this is working with my selected interpreter.  
Run code (triangle) is still running with python -u and not working for some python files

update:  
I downloaded python package from the official site and now everything seems to work

---

<div class="post-metadata">

**Author:** ![betalin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/betalin/32/4790_2.png) [@betalin](https://forum.codewithmosh.com/u/betalin)\
**Post date:** [October 11, 2022, 7:32am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/14 "2022-10-11T07:32:37Z")

</div>

I got the same issue. After digging in the introduction of Code Runner, I found out the the default command for running python is “python -u”.  
Simply go to the settings\>Extensions\>Run Code Configuration then find executorMap, and click the “Edit in setting.json” button.

You’ll see something like this screenshot. Edit the “python” line, make sure it’s `"python": "python3 -u"`  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/6/6167dd6c87a51c011f31c578d662fd0a82425858.png)

---

<div class="post-metadata">

**Author:** ![NinaNina](https://avatars.discourse-cdn.com/v4/letter/n/2acd7d/32.png) [@NinaNina](https://forum.codewithmosh.com/u/NinaNina)\
**Post date:** [March 10, 2023, 1:40am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/15 "2023-03-10T01:40:05Z")

</div>

Hello everyone, I can share what that worked for me. Hope it’s helpful to you too. It’s a temporary solution, helpful if you are working with a specific language

Step 1: Go to your Mac’s terminal and type: python3 – version  
You will see something like this: Python 3.11.2  
copy the whole version name

Step 2: Go to VS-\>Extensions → Code runner  
Click on the gear to the right of the to Uninstall button → Extension settings  
Scroll down to the 4th option: Code-runner: Default Language  
Paste the Python version you copied in Step1  
This should work 🤞

PS. If you scroll further down to the 6th setting you will find the executor map settings mentioned in the video. Then chose edit settings.json. I followed the video instructions by changing python -u to python3 (since you are directly in user settings) but it didn’t work for me. You can try that too maybe it works

---

<div class="post-metadata">

**Author:** ![lulubonee](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@lulubonee](https://forum.codewithmosh.com/u/lulubonee)\
**Post date:** [June 29, 2023, 3:56am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/16 "2023-06-29T03:56:45Z")

</div>

Thank you!!! This worked for me.

---

<div class="post-metadata">

**Author:** ![priyanshu11](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@priyanshu11](https://forum.codewithmosh.com/u/priyanshu11)\
**Post date:** [March 27, 2024, 6:05am UTC](https://forum.codewithmosh.com/t/how-to-change-code-runner-on-vs-code-from-python-u-to-python-3/10047/17 "2024-03-27T06:05:57Z")

</div>

how did you edit the setting.json file? it is into read only mode for me
