5

I'm trying to get python to work with VS code and struggling hard.

I've installed multiple version of python previously and have uninstalled them all and reinstalled with the latest version of anaconda. Link to a screenshot of the problem below. I'm only just getting back into coding for the first time in years. It's going to be something stupid.

screenshot

5
  • C:UsersGodziAnaconda3python.exe should probably be more like C:\Users\Godzi\Anaconda\3\python.exe. Not sure if you've set that path yourself, but the path is broken. And if you're new to Python (no idea of your history) i'd probably start out with just regular Python, not Anaconda. Unless your end goal is to learn machine learning as your first project. Commented Sep 10, 2019 at 8:20
  • Brand new to python. Done a bit of C back in the day and matlab. Machine learning is my first project. I haven't set the path myself, Not sure exactly how to change it. I checked the settings and it looks good there. imgur.com/a/YM0otOf Commented Sep 10, 2019 at 8:26
  • Add python to the path variables. Commented Sep 10, 2019 at 8:58
  • @Reef Sadly I always run my Python code in a vanilla terminal, but as Abdullah says, check so that your executable is in your $PATH in windows. Might work :) Commented Sep 10, 2019 at 9:34
  • Python interpreter was placed in a new location in the status bar. Check this answer. Commented May 13, 2022 at 13:17

2 Answers 2

6

Here's the solution:

  1. If you're not using Code Runner: Per this answer, you need to go to settings (press Ctrl+, to do so) and type "Python Terminal Execute in File Dir". Then tick the first checkbox that shows up and you're done.
  2. If you are using Code Runner: Go to settings and type "Code-runner: File Directory as Cwd" into the search bar. Then tick the first checkbox that shows up and you're done. You don't need to do step one of my answer, but you can if you want to.
Sign up to request clarification or add additional context in comments.

Comments

0

I use extension Code Runner to run Python code inside Visul Studion Code. This extension run your code in "OUTPUT" instead "TERMINAL". To run the code you need to select it and click shortcut "CTRL+Alt+N".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.