In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "execute python script, prompt error: / usr/bin/ Python ^ M: interpreter error: how to solve without that file or directory", interested friends might as well take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "execute python script, prompt error: / usr/bin/ Python ^ M: interpreter error: how to solve without that file or directory"!
/ usr/bin/ Python ^ M: interpreter error: no such file or directory
[1] problem phenomenon
Execute python script with error: / usr/bin/ python ^ M: interpreter error: there is no such file or directory
[2] cause analysis
Most of this is because the script files have been edited under windows. Under windows, each line ends with\ r\ n, while under linux, the file ends with\ n.
So, when the file you edited under windows is opened under linux, each line will have an extra character\ r, while under linux the file ends with\ n
When you use cat-A filename, you can see that the\ r character is displayed as ^ M. in this case, you only need to delete this character.
The local phenomenon is shown in the following picture:
[3] solution
3.1in Windows environment
Use editor tools such as UltraEdit or EditPlus to transcode the script and then put it into Linux for execution.
Conversion procedure (UltraEdit): File--- > Conversions--- > DOS- > UNIX.
3.2 in Linux environment
(1) make sure that the file has executable permissions: chmod 777 filename
(2) Open the file: vim filename
(3) View the format. Use the following command to view the file format:: set fileformat or: set ff
(4) format information. You should see the following message: fileformat=dos or fileformat=unix
(5) modify the format. The following command format:: set ff=unix or: set fileformat=unix
(6) Save and exit. You can execute the filename file in. / filename mode
At this point, I believe you have a better understanding of "execute python script, prompt error: / usr/bin/ Python ^ M: interpreter error: how to solve without that file or directory", you might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.