0

So using the Command Palette, I specified my intended Python interpreter already. This is reflected correctly in the status bar on the bottom left.

img

However, when I run the code above, it attempts to use another Python interpreter. This is clearly reflected in the Python error - it tries to run a Python 2.7 interpreter, and so it tells me that I need to install xlrd, even though I already have it installed in the right Python interpreter.

Can't seem to find anyone else having similar problems. The exact same code runs fine in another IDE like Spyder.

When i do:

import sys
print(sys.version)

It shows me the right version.

My code actually runs when I run each cell individually. It's when I run everything together (Ctrl-Alt-N) where I start seeing this error.

1 Answer 1

1

It's because you're executing code using the Code Runner extension instead of the Python extension. If you disable Code Runner for your workspace and then use the Python extension (the Play button will be green in this case) then it will use the interpreter shown in your status bar.

Sign up to request clarification or add additional context in comments.

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.