익명 03:24

“bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such ...

“bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory” error when trying to install something

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


Top Answer/Comment:

/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.

상단 광고의 [X] 버튼을 누르면 내용이 보입니다