简体   繁体   中英

How to fix “Can't find Python executable” error while already I set the PYTHON variable on Linux

I am using node.js on LINUX plcnext plc but I have installed another PYTHON version. I made sure that it is stated in my PATH and PYTHON variables and I also set it in npm using npm config set python . Yet I receive the same error Error: Can't find Python executable. Check all code below

When I type which python I get correct path:

/home/root/.guix-profile/bin/python

Result for echo $PYTHON :

/home/root/.guix-profile/bin

Result for echo $PATH :

/home/root/.guix-profile/bin:/home/root/.guix-profile/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin:/opt/plcnext/appshome/data/60002172000051/bin:/opt/bin:/opt/sbin:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin:/opt/plcnext/appshome/data/60002172000051/bin

Command I used to set python in npm:

npm config set python /home/root/.guix-profile/bin

When I try command "npm install -g bcrypt" I receive error:

node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "/home/root/.guix-profile/bin", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)

The $PYTHON variable needs to be the executeable or a link to the executeable and not the lookup directory

PYTHON=/home/root/.guix-profile/bin/python

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