pythonvisual-studioursina

I have a problem with running Ursina in VS


I have installed the ursina package via pip, and checked that it installed correctly. However, when I try running the test code in Visual Studio:

from ursina import *

app = Ursina()

app.run()

I get the following exception:

' No module named 'ursina' '

But whenever I launch the code in Sublime Text, IDLE, or in the console, the program works just fine. How can I fix this exception in Visual Studio?

I tried searching for the same problem, but there are no answers to that on Reddit, SO, or even in official documentation.


Solution

  • The issue you are having is that Visual Studio Code is not finding the right python executable, meaning you need to select the right executable from within visual studio code.

    To find what python executable you are currently using, use which python from the commandline.

    This question discusses how to select the python intrpreter from visual studio code. In short, you need to hit the Ctrl+Shift+P keybind, and then type python: select interpreter. This should bring up the right menu to select the interpreter you are using, after which the error should disaper.