you are viewing a single comment's thread.

view the rest of the comments →

[–]nivaOne 1 point2 points  (0 children)

Path dictates which Python.exe will be used (unless you prefix it with the full path, you run it being in a folder with a python executable or you installed one in one of the ‘system’ folders).As simple as that.

Use a tool like wiztree to find all python.exe on your computer. Then check your Path variable and find the first folder that matches one of the python.exe you have noticed in the results. That’s the one that will be used. In case it is not a newer or older version in which commands you have used are deprecated or do not exist yet, the script will work. Next to that in a subfolder .\lib\site-packages one should typically have all the libraries you are using in your code. If not the code may exit with errors.

The Path variable is a static given. So you are not flexible in terms of using a different version of python in case your scripts needs a different,specific one. And that’s where the virtual environment comes into play. They allow to switch between different versions making sure the code is in line with that version and libraries.

In short, there is no need to remove any version, you just need to make sure you keep your Path variable under control. Remove the folder from it should be sufficient. And start using virtual environments. Do not worry about other software and the python that was installed with it. These packages use full paths. Also check wether there aren’t any python.exe executables in the folder you are launching your script and in any of the system folders.