一半君的总结纸

听话只听一半君

python tips: 为什么有时运行.py时出现 No such file or directory 错误?

有时候你会发现直接运行某个.py 文件会出现如下提示,但是直接python myWindow.py 又可以运行没任何问题

> myWindow.py
: No such file or directory

我已经

chmod +x myWindow.py

了啊, shebang line也有了

#!/usr/bin/env python2

这是因为line endings不对,可能你在windows上编辑过此文件,你用的text editor 设置里默认保存成了windows的 line ending,一般高大上的编辑器里都可以设置保存成哪种,现在可以自己改回来,比如sublime里

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: