Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ubuntu /usr/bin/env: python: No such file or directory

I update the kernel, after that the Ubuntu doesn't work well, PS: I try to exec "meld" command, it will report that "/usr/bin/env: python: No such file or directory", then I exec "sudo apt-get install python" and get the result "python is already the newest version.", what should I do for it.


I'm not good at linux, can you tell me how to revert my linux to the last right status, or reinstall the python normally.

like image 513
Hao Avatar asked Sep 07 '10 02:09

Hao


People also ask

Can't execute Python No such file or directory?

The Python "FileNotFoundError: [Errno 2] No such file or directory" occurs when we try to open a file that doesn't exist in the specified location. To solve the error, move the file to the directory where the Python script is located if using a local path, or use an absolute path.

What does usr bin env python mean?

If you have installed many versions of Python, then #!/usr/bin/env ensures that the interpreter will use the first installed version on your environment's $PATH. If you are using Unix, an executable file that is meant to be interpreted can indicate what interpreter to use by having a #!


1 Answers

Problem scenario:

/usr/bin/env: ‘python’: No such file or directory 

Possible Solution #1

  • If Python 3 is not installed, install it: apt-get install python3

Possible Solution #2

  • If Python 3 has been installed, run these commands: whereis python3

  • Then we create a symlink to it: sudo ln -s /usr/bin/python3 /usr/bin/python

like image 155
Francesco Mantovani Avatar answered Sep 22 '22 11:09

Francesco Mantovani