简体   繁体   中英

Where is the "python" environment variable set?

I have run into an issue with installing some npm packages for an app on Windows 10. Specifically gyp seems to be causing trouble, because it cannot find the python executable.

Here is part of the output of npm install in PowerShell:

在此处输入图片说明

Previously I had Cygwin installed, but then I deleted it, updated to Windows 10 and installed the Linux Subsystem for Windows. But obviously the Cygwin python path is still somewhere set in an environment variable.

The problem is, I cannot find this environment variable.

The python environment variable is set to C:\\Users\\myaccount\\.windows-build-tools\\python27\\python.exe .

The path environment variable only contains C:\\Users\\myaccount\\.windows-build-tools\\python27\\ , no other python directories.

There is no pythonpath environment variable.

I checked all these variables with PowerShell and in Extended System Settings.

Where on earth is npm or gyp taking the python path from?

As it turned out, before looking at the environment variables gyp looks in npm-config for a python entry. In my case the python entry was set like this:

; userconfig C:\Users\myaccount\.npmrc
python = "C:\\cygwin64\\bin\\python2.7.exe"

After deleting the python entry in npm-config with

npm config delete python

gyp found the python executable trough the python environment variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM