推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
vicence
V2EX  ›  Python

.py文件无法直接执行

  •  
  •   vicence · Sep 8, 2013 · 4687 views
    This topic created in 4774 days ago, the information mentioned may be changed or developed.


    权限也加了,就是无法执行
    10 replies  •  1970-01-01 08:00:00 +08:00
    ipconfiger
        1
    ipconfiger  
       Sep 8, 2013
    whereis python 看看你的解释器地址是不是 /usr/bin/python
    lennyh
        2
    lennyh  
       Sep 8, 2013
    shbang line有问题,貌似是文件格式的原因,试试dos2unix...
    hadoop
        3
    hadoop  
       Sep 8, 2013
    输入命令 which python 看看你的python的路径是哪个
    vicence
        4
    vicence  
    OP
       Sep 8, 2013
    @hadoop
    @ipconfiger

    都没问题
    skydiver
        5
    skydiver  
       Sep 8, 2013
    @vicence 脚本第一行写的什么?
    vicence
        6
    vicence  
    OP
       Sep 8, 2013
    @skydiver
    @ipconfiger
    @lennyh
    @hadoop
    是文件格式问题,谢谢你们
    013231
        7
    013231  
       Sep 8, 2013
    換行符的問題, 注意那個^M.
    Mutoo
        8
    Mutoo  
       Sep 8, 2013
    看到状态栏 a.py[+][python,,dos]
    果断 :set ff=unix
    vicence
        9
    vicence  
    OP
       Sep 9, 2013
    在window下,无论是dos,还是unix,都没问题,在太坑爹了
    TankyWoo
        10
    TankyWoo  
       Sep 9, 2013
    EOL的问题, 以前我也遇到过, 记录了下:

    http://www.wutianqi.com/?p=3392
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1112 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 17:14 · PVG 01:14 · LAX 10:14 · JFK 13:14
    ♥ Do have faith in what you're doing.