Python Environment Defaulting to Conda, Environment Variables Ineffective

538
1
02-23-2022 03:11 PM
HaroldKrivell
New Contributor III

Good Evening, 

I have a customer who's Python Scripts are defaulting to the Conda environment when he intends on using Python 2.7. We set the variables back to Python 2.7, and we are able to CMD line scrips to 2.7. But when double clicking or using automated processes, the environment switches to Python 3.9 in the Conda folder.

Environment Variables have been sent to Python 2.7 in user and system path variables. Python 2.7 is prioritized and I can tell the changes are carried over to the command line when running C:\. How do I switch back to Python 2.7 when double-clicking a .py file?

 

0 Kudos
1 Reply
by Anonymous User
Not applicable

I think you need to associate the .py file extension with the 2.7 python.exe/ env OR create a bat file you double click on to start the script in the designated env.

Right click on the file.py, select open with, navigate to python.exe and select make default or always open with if it gives you the option. Or in settings, default apps, find py and set it. Depending on your os and version, there are different ways to set the default application for the file extension but there are tons of how-to’s online.