In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to solve the problem of bash: /usr/bin/autocracker: /usr/bin/python^M: bad interpreter: No such file or directory". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "how to solve the problem of bash: /usr/bin/autocracker: /usr/bin/python^M: bad interpreter: No such file or directory" together!
Python script written under windows system, after granting permission chmod +x xxx.py under linux, execute./ xxx.py run instructions: bash: /usr/bin/autocritter: /usr/bin/python^M: bad interpreter: No such file or directory
Analysis:
This is caused by different system encoding formats: .sh .py files edited on Windows may have invisible characters, so executing them on Linux will report the above exception message. This is usually due to the difference in the end-of-line identifier between windows and linux.
Solution:
1) Convert under Windows:
Use tools such as UltraEdit or EditPlus to encode scripts before putting them into Linux for execution. The conversion method is as follows (UltraEdit): File--> Convertions-->DOS->UNIX.
2) Direct replacement under Linux:
sed -i 's/^M//g' filename (note ^M is written in Linux press ^M for carriage return, input method is hold down CTRL+v, release v, press m)
3) It can also be converted in Linux:
First, make sure the file has executable permissions
The code is as follows:
#sh>chmod a+x filename
Then modify the file format
The code is as follows:
#sh>vi filename
Use the following command to view file formats
:set ff or:set fileformat
You can see the following information
fileformat=dos or fileformat=unix
Modify the file format using the following command
:set ff=unix or:set fileformat=unix
:wq (save exit)
Final execution file
#sh>./ filename
Thank you for reading, the above is "how to solve bash: /usr/bin/autocracker: /usr/bin/python^M: bad interpreter: No such file or directory problem" content, after the study of this article, I believe that you have a deeper understanding of how to solve bash: /usr/bin/autocracker: /usr/bin/python^M: bad interpreter: No such file or directory problem, the specific use of the situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.