Before Windows wrote a Python script, run no problem, today under Linux, the script at the beginning of the comment line has indicated the path of the interpreter, but also with chmod to execute permissions, but not directly run the script.
1 question 1: Error:: No such file or directory#!/usr/bin/env pythonchmod a+x test.py Workaround: Open the Sh file with Vim, enter:: Set FF carriage return, show file Format=dos, reset the file format:: Set Ff=unix Save exit
2 problem 2:linux Remove Windows line break
First, the use of VI editor, VI is a UNIX-like system powerful editor, using VI, can solve many problems for us:
1. vi File name
2. Press ESC
3. Enter the following string:%s/^m//g (note, ^m = Ctrl V + CTRL M instead of manually entering ^m)
4. Direct enter enter (^m cleared successfully)
5.: wq! (Save exit)
Windows Python file copy to Linux execution problem