簡體   English   中英

在 CentOS 8 上用 python 編譯返回錯誤

[英]Compiling with python on CentOS 8 returns errors

我已經安裝了最新的 node、npm 和 python 版本,但是當我嘗試安裝 leveldown(使用 npm)時出現以下錯誤:

> leveldown@2.1.1 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 auth@1.0.0 No description
npm WARN auth@1.0.0 No repository field.
npm WARN auth@1.0.0 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! leveldown@2.1.1 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the leveldown@2.1.1 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 上編譯......歡迎任何幫助

僅供參考,我沒有直接使用 leveldown,但它是 PouchDB 的依賴項

您已經安裝了 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的生命周期剛剛結束 任何此時仍需要 Python 2 的軟件可能已經有一段時間沒有更新了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM