[在CentOS 8上使用python编译会返回错误

问题描述 投票:0回答:1

我已经安装了最新的节点,npm和python版本,但是当我尝试安装leveldown(使用npm)时出现以下错误:

> [email protected] install /root/apps/authentication/node_modules/leveldown
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=10.16.3 runtime=node arch=x64 platform=linux)
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Linux 4.18.0-80.11.2.el8_0.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/apps/authentication/node_modules/leveldown
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-08T21_40_49_710Z-debug.log

似乎python无法在CentOS 8上编译...欢迎任何帮助

仅供参考,我没有直接使用降级功能,但这是PouchDB的依赖项

python centos leveldown
1个回答
1
投票

[您已经安装了Python 3,但是正在运行需要Python 2的代码。可以安装python2软件包,然后可以指示npm安装过程使用/usr/bin/python2而不是/usr/bin/python

如果不可能,您应该可以将/usr/bin/python链接到/usr/bin/python2。默认情况下,CentOS 8没有/usr/bin/python(它只有python2python3命令),因此这应该是无害的。


请注意,Python 2刚刚达到end of life。此时仍然期望使用Python 2的任何软件可能已经有一段时间没有更新了。

© www.soinside.com 2019 - 2024. All rights reserved.