I have a problem after I moved my code from Pycharm to Visual Studio Code. I use the exakt same Interpreter for both. For my programming I need some imports that i had to manuel install and some that are preinstalled with Python. That that are preinstalled work perfektly fine but for every pip-installed import, VSC says "import could not be resolved" altrough it works on Pycharm and in cmd just works fine! When i write in the console for expample "pip install numpy" it says it is installed! Does anyone know what the problem is?
I try to reinstall Python, all imports and Visual Studio code, but that helped not. Additionaly I searched the web and stackoverflow if somebody had similar problems and that was the case. Altrough nobody described the eroor that some imports work and some not, i tryed most of the Suggested solutions but they did nnot helped. You cant see it on the photo but the code runs WSL: Ubuntu, maybe that helpes.
In the Terminal its says numpy is installed, right after it says there is no module named numpy
terminal version is 3.11.1 but import is saved in Python3.8
CodePudding user response:
In your picture, on the bottom right, you can see that you are running Python 3.11.1 while your terminal output says that numpy is installed in a Python 3.8 environment.
So it seems like your terminal is working with another environment. Did you choose your interpreter (probably one with Python 3.8) in VSCode with Ctrl Shift P, then type Select Interpreter, then select the interpreter?
CodePudding user response:
Ok I found the cause of the error. The cause was that I focused on working with the new 3.11 or 3.10 and ignored completly to test if the 3.8 would work. By a by lucky accident I tried it and it works!