Skip to content Skip to sidebar Skip to footer

Can't Find Python Executable "python"

When i install iconv with npm got the following error: iconv@2.1.0 install /root/Dropbox/nodeApps/nodeApp/node_modules/iconv node-gyp rebuild gyp ERR! configure error gyp ERR!

Solution 1:

For anyone encountering this issue on Ubuntu 16.04...
node-gyp can't use Python 3.5.X which seems to the be the default that ships with 16.04. I read somewhere that 16.04 was supposed to ship with Python2 as well but I can't find it on my install.

I fixed the above issue by:

apt-get update     
apt-get install python2.7    
ln -s /usr/bin/python2.7 /usr/bin/python 

Now when node-gyp goes looking for python it will hit your Python2.7 install and load correctly.


Solution 2:

In your bash session where you're able to just type python and get a valid response, type in which python and note the full path location of the python binary. Take that location and put that into your PYTHONPATH and PATH environment variables, except without the python at the end.

For example, which python gives me:

/usr/local/bin/python

so I would write:

export PYTHONPATH=$PYTHONPATH:/usr/local/bin
export PATH=$PATH:/usr/local/bin

in my ~/.bashrc.


Solution 3:

There is a simple and safe way Place this into ~/.bashrc or ~/.bash_aliases file:

alias python=python3

After adding the above in the file, run source ~/.bashrc or source ~/.bash_aliases

This solution worked for my Ubuntu see the origin answer here


Solution 4:

Install python2.7.
apt install python2


Solution 5:

the problem was because of ~/.bashrc was not loaded on ssh login. I put PATH vars to ~/.bash_profile and it's ok


Post a Comment for "Can't Find Python Executable "python""