0

I apologize, I don't have much experience with Linux. So I have ruby installed on my machine and I'm trying to install rails. When I do gem install rails I get a proper response

Successfully installed rails-6.0.3.2 1 gem installed 

But when I do rails --version it returns the following:

bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory 

What can be the issue here?

My machine is running on Zorin OS. By the way here's some more information: temp-user@Lenovo-IdeaPad-S145-5:~$ ls -l /usr/bin | grep python

lrwxrwxrwx 1 root root 23 Nov 7 2019 pdb3.6 -> ../lib/python3.6/pdb.py lrwxrwxrwx 1 root root 23 Nov 7 2019 pdb3.7 -> ../lib/python3.7/pdb.py lrwxrwxrwx 1 root root 31 Nov 26 2019 py3versions -> ../share/python3/py3versions.py lrwxrwxrwx 1 root root 18 Jul 6 00:51 python -> /usr/bin/python2.7 lrwxrwxrwx 1 root root 9 Mar 28 01:44 python3 -> python3.5 -rwxr-xr-x 2 root root 4526456 Nov 7 2019 python3.6 -rwxr-xr-x 2 root root 4526456 Nov 7 2019 python3.6m -rwxr-xr-x 2 root root 4873376 Nov 7 2019 python3.7 -rwxr-xr-x 2 root root 4873376 Nov 7 2019 python3.7m lrwxrwxrwx 1 root root 10 Nov 26 2019 python3m -> python3.6m 

at one point i might have tried to change python versions, but i don't remember exactly
in my /usr/bin/ there are a lot of python's installed

python python3 python3.6 python3.6m python3.7 python3.7m python3m 
4
  • Did you a syste intallation or a user installation, you mention neither sudo nor --user-install? Commented Jul 5, 2020 at 22:20
  • @xenoid just went with gem install rails, no sudo, so I guess it's a user installation? Commented Jul 5, 2020 at 22:24
  • On my Ubuntu, gem install rails fails because it tries to install system-wide. Which distro/version? Commented Jul 5, 2020 at 22:30
  • @xenoid Zorin OS 15 Commented Jul 5, 2020 at 22:34

2 Answers 2

0

/usr/lib/command-not-found is a piece of code that tries to make suggestions when the command you typed cannot be found (spelling errors, or suggests the installation of package that provide the command). It happens to be written in Python3, and Python3 may not be installed on your system (even though it's kind of mandatory on recent Linux distros...).

But you get this error because the rails command cannot be found. Since you ran the installation as a user space, rails is likely in some user directory that you have to add to your PATH (edit your ~/.profile). You can use gem list -d to find the directory.

3
  • that didn't help unfortunately so i just pasted export PATH="$PATH:$HOME/temp-user/.gem" into my ~/.profile as gem list -d said rails are installed here /home/temp-user/.gem but nothing has changed Commented Jul 5, 2020 at 22:02
  • Did you re-execute the profile (. ~/.profile)? You can also just execute .export PATH="$PATH:$HOME/temp-user/.gem in your current bash session. Commented Jul 5, 2020 at 22:14
  • yes, i did, but it didn't help :( Commented Jul 5, 2020 at 22:19
0
apt install python 

fixed it for me..

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.