跑老项目python报错 gyp verb check python checking for Python executable "python2" in the PATH gyp

君哥 阅读:1301 2025-05-12 10:19:26 评论:0
warning Error running install script for optional dependency: "C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nodejieba: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nodejieba
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.11
node-pre-gyp info using node@14.21.3 | win32 | x64
node-pre-gyp info check checked for \"C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nodejieba\\build\\Release\\nodejieba.node\" (not found)
node-pre-gyp http GET https://github.com/yanyiwu/nodejieba/releases/download/v2.5.2/nodejieba-v2.5.2-node-v83-win32-x64.tar.gz
node-pre-gyp ERR! install request to https://github.com/yanyiwu/nodejieba/releases/download/v2.5.2/nodejieba-v2.5.2-node-v83-win32-x64.tar.gz failed, reason: read ECONNRESET
node-pre-gyp WARN Pre-built binaries not installable for nodejieba@2.5.2 and node@14.21.3 (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error request to https://github.com/yanyiwu/nodejieba/releases/download/v2.5.2/nodejieba-v2.5.2-node-v83-win32-x64.tar.gz failed, reason: read ECONNRESET
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@14.21.3 | win32 | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@14.21.3 | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\\Python313\\python.EXE -c import sys; print \"%s.%s.%s\" % sys.version_info[:3];
gyp ERR! stack   File \"\", line 1
gyp ERR! stack     import sys; print \"%s.%s.%s\" % sys.version_info[:3];
gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:383:12)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at maybeClose (internal/child_process.js:1088:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Users\\\\007\\\\Downloads\\\\itsm-master\\\\h5\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--module=C:\\\\Users\\\\007\\\\Downloads\\\\itsm-master\\\\h5\\\\node_modules\\\\nodejieba\\\\build\\\\Release\\\\nodejieba.node\" \"--module_name=nodejieba\" \"--module_path=C:\\\\Users\\\\007\\\\Downloads\\\\itsm-master\\\\h5\\\\node_modules\\\\nodejieba\\\\build\\\\Release\" \"--napi_version=8\" \"--node_abi_napi=napi\" \"--napi_build_version=0\" \"--node_napi_label=node-v83\"
gyp ERR! cwd C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nodejieba
gyp ERR! node -v v14.21.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\\Program Files\\nodejs\\node.exe C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\node-gyp\\bin\\node-gyp.js configure --fallback-to-build --module=C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nodejieba\\build\\Release\\nodejieba.node --module_name=nodejieba --module_path=C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nodejieba\\build\\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess. (C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\@mapbox\\node-pre-gyp\\lib\\util\\compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1088:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
node-pre-gyp ERR! System Windows_NT 10.0.19045
node-pre-gyp ERR! command \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Users\\\\007\\\\Downloads\\\\itsm-master\\\\h5\\\\node_modules\\\\@mapbox\\\\node-pre-gyp\\\\bin\\\\node-pre-gyp\" \"install\" \"--fallback-to-build\"
node-pre-gyp ERR! cwd C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nodejieba
node-pre-gyp ERR! node -v v14.21.3
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok
Failed to execute 'C:\\Program Files\\nodejs\\node.exe C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\node-gyp\\bin\\node-gyp.js configure --fallback-to-build --module=C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\nod[-/6] ⠄ waiting...
[-/6] ⠄ waiting...
[-/6] ⠄ waiting...
[4/6] ⡀ node-sass
error C:\Users\007\Downloads\itsm-master\h5\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: C:\Users\007\Downloads\itsm-master\h5\node_modules\node-sass
Output:
Building: C:\Program Files\nodejs\node.exe C:\Users\007\Downloads\itsm-master\h5\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@14.21.3 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\007\Downloads\itsm-master\h5\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\007\Downloads\itsm-master\h5\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:192:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\007\Downloads\itsm-master\h5\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\007\Downloads\itsm-master\h5\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\007\Downloads\itsm-master\h5\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:192:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Python313\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python313\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:383:12)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at maybeClose (internal/child_process.js:1088:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\007\\Downloads\\itsm-master\\h5\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\007\Downloads\itsm-master\h5\node_modules\node-sass
gyp ERR! node -v v14.21.3
  

跑一个老项目报错这个,python 版本问题

步骤 1:安装 Python 2.7
Node-gyp 在旧版本中依赖 Python 2.7,而您当前使用的是 Python 3.x。

下载并安装 Python 2.7。
https://www.python.org/downloads/release/python-2718/

~~~

安装时勾选 Add python.exe to Path。

配置 npm 使用 Python 2.7:

npm config set python "C:\Python27\python.exe"

然后再切换nodejs 版本

nvm use 14 

安装依赖 再启动 成功!

本文链接:http://www.yanjun202.com/post/138.html 

分享到:
可以去百度分享获取分享代码输入这里。
发表评论
搜索
排行榜
关注我们

扫一扫关注我们,了解最新精彩内容