Heim  >  Fragen und Antworten  >  Hauptteil

Ich bin neu bei Python und erhalte beim Debuggen eine Fehlermeldung. Ich kenne den Grund nicht.

Geschrieben unter Pycharm.
Die Fehlermeldung lautet wie folgt:

C:\Python27\python.exe "C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 51755 --file E:/python/first.py
pydev debugger: process 4988 is connecting

Connected to pydev debugger (build 171.4249.47)
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py", line 1585, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py", line 1015, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "E:/python/first.py", line 3
SyntaxError: Non-ASCII character '\xe7' in file E:/python/first.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Process finished with exit code 1

Später erinnerte ich mich daran, ich war nachlässig ... Ich erinnere mich an das erste Mal, als ich es debuggte,

Ich muss den Dateipfad im Kreis im Bild unten ändern. Nachdem ich den Dateipfad geändert habe, kann das Programm ausgeführt werden.
Wenn ich also ein neues Programm zum Debuggen erstelle, muss ich den Dateipfad hier manuell ändern ?

某草草某草草2710 Tage vor696

Antworte allen(2)Ich werde antworten

  • PHPz

    PHPz2017-05-19 10:09:02

    File "E:/python/first.py", line 3
    SyntaxError: Non-ASCII character 'xe7' in file E:/python/first.py on line 3, but no encoding declared;

    这里的问题,第三行,中文解码错误,是不是用了中文的标点符号

    Antwort
    0
  • 巴扎黑

    巴扎黑2017-05-19 10:09:02

    代码中用了中文逗号,换成英文格式就好。提示里有指出。

    Antwort
    0
  • StornierenAntwort