I’m trying to use the NPM package, but I’m getting the following error in my terminal: Can’t find Python executable “python,” you can set the PYTHON env variable in Python.
I tried to solve the issue and sharing all possible ways that can help you to resolve the below error in Python:
Can't find Python executable "python", you can set the PYTHON env variable
Why Can’t find Python executable “python”, you can set the PYTHON env variable Error Occurs?
When I tried to use the NPM package, below error is shown in my terminal:
Can't find Python executable "python", you can set the PYTHON env variable
Can’t find Python executable “python”, you can set the PYTHON env variable Error is basically seen because of python path variable isn’t set into you windows.
How to Solve Can’t find Python executable “python”, you can set the PYTHON env variable Error?
To Solve error, you need to set the python path variable into windows.
Below are the all possible ways that can work to solve Can’t find Python executable “python”, you can set the PYTHON env variable Error in Python:
Fix 1: Set Path Variable
if you are using Windows and Python hasn’t been installed, instal the Python into yours system. Now you need to set the python to your path variable with help of env variable. It would solve the Can’t find Python executable “python”, you can set the PYTHON env variable Error in Python.
Use the below command to set the python to path variable:
npm config set python E:\Programm Files\Python\python.exe
Note: use the python path as per yours system file path.
Fix 2: Install windows-build-tools
you can install the windows-build-tools to yours python and it would solve the error for you.
Use the below command to install the windows-build-tools into python using below command:
npm i windows-build-tools
Using any of the above method should solve the windows-build-tools Can’t find Python executable “python”, you can set the PYTHON env variable” Error in Python for you.
Conclusion
To fix the Error, either you need to set the python to your path variable using command “npm config set python E:\Programm Files\Python\python.exe” OR Install windows-build-tools to resolve the error.
Can’t find Python executable “python”, you can set the PYTHON env variable” Error in Python occurs basically because of python path variable isn’t set into you windows.