You have to learn about "virtual Nvironments": they are a resource used by the language for each project to have its own libraries, without any system conflict issues.
So, if you have a game that depends on pygame 1.8, and another that depends on pygame 2.0, you can have both installed on PC.
Also, using virtualenvs, all project dependencies are automatically found.
In general, more advanced Ides and editors like vscode support virtualenv - but of course, it’s a mechanism that doesn’t depend on Ides - only the language, and can be activated via terminal, or specified in a shortcut to run your program, create a link for it to run straight.
What a virtualenv does is put copies and shortcuts to Python and the system libraries inside a folder - which we usually keep together with the project (but it can stay anywhere). Before working with the project, or running it, we "activate" virtualenv. Then, you install any dependency on your project directly within virtualenv (even if you already installed it in the system’s Python, install it again). Then, as you understand the projects, you specify this dependency in the configuration files of the project itself - so Python can automatically install the dependencies for anyone who will install your project.
To do it on the command line: open the computer, and go with cmd to your project folder (with the "cd" command). When you get there, type python -m venv env
- Python will create an "env" folder with everything in it. Next, activate virtualenv: env\scripts\activate.bat
on Windows or source env\bin\activate
on Linux/Mac. There you can type pip install pygame
that it will be installed.
Paa work with virtuaenv in vscode, has a guide here: https://code.visualstudio.com/docs/python/environments
how many python versions are installed ?
– stack.cardoso
Two, one that I installed on disk D: and one that was installed by the Microsoft Store app on disk C:
– user238812
may have happened that the installations are linked to the installation in C and not to D. You have to specify which version will be used in the IDE. as vscode can create mv to manage the version in use. as this path, this for the version you want to use ?
– stack.cardoso
vscode options. File Preferences Settings .. chooses which python interpreter to use.. only search for "python" and "Default Interpreter Path Path to Python, you can use a custom version of Python by modifying this Setting to include the full path."
– stack.cardoso
I managed to solve my problem. Thank you very much
– user238812
In the next questions, avoid putting code or data as images. This prevents searching the site, prevents people from copying and pasting snippets of your code as an example, and disrupts a lot more.
– jsbueno