Windows Python file copy to Linux execution problem

Source: Internet
Author: User
Tags file copy python script
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.