问题1:Missing parentheses in call to 'print'

原因:因为Python2.X和Python3.X不兼容。
我安装的是Python3.X,但是我试图运行的却是Python2.X 的代码。
所以上面的语法在python3中是错误的。在python3中,你需要将print后面的语句加括号,正确的写法:
print ("hello world")

问题2:创建项目报错,django-admin startproject sundyblog
File "c:\users\andy\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\html.py", line 16, in <module>
from .html_parser import HTMLParser, HTMLParseError
File "c:\users\andy\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\html_parser.py", line 12, in <module>
HTMLParseError = _html_parser.HTMLParseError
AttributeError: module 'html.parser' has no attribute 'HTMLParseError'

原因:HTMLParseError在pythons3.5已经没有了

解决方法:

方法1:将python版本回退到3.3或3.4

方法2:升级django版本
>pip3 install django==1.8 ##升级django版本
C:\Users\andy>django-admin startproject sundyblog ##再次执行,无报错

问题3: 使用  ImageField  字段建表报错

C:\Users\andy\sundyblog>python manage.py makemigrations
SystemCheckError: System check identified some issues:

ERRORS:
blog.Article.portal: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow".

解决:C:\Users\andy\sundyblog>pip install -i https://pypi.douban.com/simple/ Pillow
Looking in indexes: https://pypi.douban.com/simple/
Collecting Pillow
Downloading https://pypi.doubanio.com/packages/0f/fe/0979c8d6fa0c986e4603e5396904945b44f93ff9e346ee5ffadc7487cff6/Pillow-5.4.1-cp35-cp35m-win32.whl
100% |████████████████████████████████| 1.7MB 351kB/s
Installing collected packages: Pillow
Successfully installed Pillow-5.4.1
You are using pip version 19.0.1, however version 19.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\andy\sundyblog>python manage.py makemigrations
Migrations for 'blog':
0001_initial.py:
- Create model Article
- Create model Author
- Add field autor to article

C:\Users\andy\sundyblog>

Python 入门级报错处理的更多相关文章

  1. mac 上python编译报错No module named MySQLdb

    mac 上python编译报错No module named MySQLdb You installed python You did brew install mysql You did expor ...

  2. 调用python脚本报错/usr/bin/env: python : No such file or directory

    一.调用python脚本报错 /usr/bin/env: python: No such file or directory 二.解决方法 原因是在windows上编写的脚本,使用dos2unix对脚 ...

  3. 第一次打开pycharm运行python文件报错”No Python interpreter selected“问题的解决办法

    前面没有细讲,这里细述一下安装pycharm后,第一次打开pycharm运行python文件报错"No Python interpreter selected"问题的解决办法. 出 ...

  4. python运行报错:urllib2.URLError: <urlopen error [Errno 10061] >

    Traceback (most recent call last): File "F:\adt-bundle-windows-x86_64-20140702\eclipse\workspac ...

  5. [Error]Python虚拟环境报错 OSError: setuptools pip wheel failed with error code 2

    mkvirtualenv py35 python新建虚拟环境报错,setuptools pip wheel failed with error code 2 刚好昨天在CentOS安装的时候也总是报s ...

  6. win7 64位 python启动报错:无法启动此程序,因为计算机中丢失api-ms-win-crt-process-l1-1-0.dll

    安装python3.7,安装成功后,在cmd窗口输入python检查是否安装成功,报错:无法启动此程序,因为计算机中丢失api-ms-win-crt-process-l1-1-0.dll 在网上查询了 ...

  7. 【转】【Python】Python 中文编码报错

    用 Python 输出 "Hello, World!",英文没有问题,但是如果你输出中文字符"你好,世界"就有可能会碰到中文编码问题. Python 文件中如果 ...

  8. python webdriver 报错WebDriverException: Message: can't access dead object的原因(pycharm中)

    PyCharm中运行firefox webdriver访问邮箱添加通讯录的时候报错-WebDriverException: Message: can't access dead object 调了半天 ...

  9. python实践报错:SyntaxError: Non-ASCII character

    报错: File "C:\001myWorkspace\001myWork\workspace2\MyFirstPython\src\demo4\demo4-2.py", line ...

随机推荐

  1. 零基础学习JavaSE(二)——基础语法

    二.Java 基础语法 2.1 Java 基础语法 java是一个面向对象的程序语言,及可把一切事物当做对象处理,而java的事物中最小的就是class (类),类中有方法,类可以创建对象,并且有一些 ...

  2. pycharm中连接数据库常见问题

    pymysql.err.InterfaceError: (0, '')解决办法   导致这个错误的原因是通过pymysql连接MySQL,没有关闭连接的操作,所以短时间内不会出问题,长时间保持这个连接 ...

  3. QT_REQUIER_CONFIG

    在qglobal.h中,定义了很多宏.下面这个QT_REQUIER_CONFIG,展开成: #define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(Q ...

  4. jmeter的几种参数化使用方法

    场景:在进行jmeter的接口自动化测试脚本的编写中需要使用参数化,现将接触到的几种参数化方法整理如下: 第一种: 使用“用户自定义变量”的配置元件来进行变量定义 填入变量.值.和备注就可以在后续的接 ...

  5. Mysql慢查询-Mysql慢查询详细教程

    一.简介开启慢查询日志,可以让MySQL记录下查询超过指定时间的语句,通过定位分析性能的瓶颈,才能更好的优化数据库系统的性能.二.参数说明slow_query_log 慢查询开启状态slow_quer ...

  6. Mysql 大量Sleep 解决

    排查 SHOW GLOBAL VARIABLES LIKE 'wait_timeout'; SHOW GLOBAL VARIABLES LIKE 'interactive_timeout'; 在线更新 ...

  7. 2018-软工机试-A-西班牙馅饼

    A. 西班牙馅饼 单点时限: 1.0 sec 内存限制: 256 MB 港岛妹妹,你献给我的西班牙馅饼 甜蜜地融化了我,天空之城在哭泣 港岛妹妹,我们曾拥有的甜蜜的爱情 疯狂地撕裂了我,天空之城在哭泣 ...

  8. 直接执行sql字符串

    $sql_tmp= "UPDATE `eabc_order_detail` set send_number=num where order_sn='".$model_order-& ...

  9. 2018上C语言程序设计(高级)- 第1次作业成绩

    作业地址 https://edu.cnblogs.com/campus/hljkj/CS2017-01/homework/1638 评分准则 第一次作业各项成绩包括三项: 完成PTA所有题目:20分 ...

  10. day10 参数args kwargs 作用域

    函数参数/作用域/args/kwargs 1.参数 1.1参数基本知识 任意个数 任意类型 func("1",True) 1.2位置传参(调用函数并传入参数) def func(a ...