. Advertisement .
..3..
. Advertisement .
..4..
There are some variables and constant values in every program. As the name implies, we have environment variables that specify the environment for some applications. These variables come in a variety, and we can define our environment-specific variables. “Can’t find Python executable “python”, you can set the PYTHON env variable” is a common error in Python. Let’s learn about how this error occurs and what we can do to fix it through this article.
How Does This Error “Can’t find Python executable “python”, you can set the PYTHON env variable” Happen?
While running the program, you easily get the following error:
Can’t find Python executable “python”, you can set the PYTHON env variable
The error may continue when an application cannot locate the Python executable file. This problem is also frequently seen when installing Node.js and NPM on Windows. There are a couple of other remedies for such circumstances as well.
What Can We Do To Fix The Error “Can’t find Python executable “python”, you can set the PYTHON env variable”?
In this article, we will give you three solutions to solve the error “Can’t find Python executable “python”, you can set the PYTHON env variable”. They are very helpful and efficient. Let’s follow them!
Solution 1: Do the steps described below
Make sure the entire path to the python.exe file is set to the environment variable if an application cannot locate the Python executable file. You can check this on Windows by doing the steps described below. You first need to right-click This PC and choose the Properties option from the menu. After that, you must select Environment Variables from the Advanced Settings menu.
You will then be directed to the Environment Variable screen, where you must add the Python executable path. The directory must be added to the User’s PATH variable. If the problem still occurs, you can add the directory to a new variable called Python.
This solution can help you remove the error, let’s try this.
Solution 2: Use Microsoft windows-build-tools
You also can use Microsoft windows-build-tools to set up any required tools to solve the problem “Can’t find Python executable “python”, you can set the PYTHON env variable”. To do that, let’s use the command below in the command prompt.
npm install -g windows-build-tools
However, some Python versions will be install in a new environment with this method. The npm config command also allows you to specify the path of the Python executable. It may help in some circumstances. As indicated below, use it:
npm config set python C:\Dir\Python\Python27\python.exe
Solution 3: Update and upgrade NPM
Excepting two solutions mentioned above, updating and upgrading NPM is also an excellent method for this error. Now, let’s run the following command:
sudo npm install npm@latest -g
Conclusion
We believe with these solutions, you can easily resolve the problem “Can’t find Python executable “python”, you can set the PYTHON env variable”. Let us know which solution worked best for you and if you have any comments or questions don’t hesitate to write them down in the comments section, we are always here to help you. Thank you for reading!
Read more
→ How to Fix “NameError: name ‘raw_input’ is not defined in Python”
Leave a comment