1.print "hello world!";
SyntaxError:Missing parentheses in call to ‘paint’ . Did you mean print(“hello world”);?
在調用“paint”時缺少圓括號。
上面的語法在python3中是錯誤的。在python3中,你需要將helloworld加括號。print ("hello world!");
?2.python中出現SyntaxError: Non-UTF-8 code 解決方法:
第一種,設置源碼文件編碼,放在源碼文件第一第二行:# coding=<encoding name>
第二種,通用的編輯器設置編碼:# -*- coding: <encoding name> -*-
第三種:# vim: set fileencoding=<encoding name> :
第四種,沒有翻譯行,使用純文本:# This Python file uses the following encoding: utf-8
例子:在程序開始處添加一條如上所未的編碼定義其中gbk(帶有中文的編碼)或者其他編碼格式所指定的編碼。
#!/usr/bin/python #-*-coding:gbk-*-
?詳細請看官方文檔:https://www.python.org/dev/peps/pep-0263/
python錯誤類型?3.在window系統cmd中通過pip指令安裝其他模塊包失敗,老是提示找不到相應的參數。
方法:在環境變量配置中,不僅要把python配進去,還要把python下的scripts路徑配進去,因為pip指令在scripts路徑下。
?
?