问题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. 待实验的socketserver

    # -*- coding:utf-8 -*-# Author: Dennis Huang__Author__ = "Dennis" import socketserver clas ...

  2. ftp远端上的文件下载

    用linux下的wge下t载比在window下一个个点方便多了,命令如下: wget ftp:// 110.110.110/\*.mseed --ftp-user=username --ftp-pas ...

  3. [py]Win10下的pip/pip3 install 导致utf-8编码问题的解决方案

    置顶感谢:http://blog.csdn.net/qq_33530388/article/details/68933201 今天安装时遇到了windows下棘手的问题 UnicodeDecodeEr ...

  4. .NetCore多文件上传进度的示例

    主要讲的内容有: 1-----form方式上传一组图片 2-----ajax上传一组图片 3-----ajax提交+上传进度+一组图片上传 4-----Task并行处理+ajax提交+上传进度+一组图 ...

  5. Rabbit 集群部署

    1.RabbitMQ是用erlang语言编写的,所以我们先安装erlang语言环境 配置erlang语言环境 # vim /etc/yum.repos.d/rabbitmq-erlang.repo [ ...

  6. 解决 error: Your local changes to the following files would be overwritten by merge:XXXX

    版权声明:这可是本菇凉辛辛苦苦原创的,转载请记得带上我家地址,不要忘记了哈 ... https://blog.csdn.net/u011314442/article/details/78852547 ...

  7. 微信小程序调用快递物流查询API的实现方法

    一. 创建index.wxml.index.wxss.index.js 附上代码: <view class='container'> <input class='info' plac ...

  8. vmware虚拟机安装了linux(redhat)系统忘记登录密码怎么办

    今天,打开了以前装过的vmware虚拟机,正常启动之后,一直想不起登录密码,怎么都是登录不进去.然后在网上查找资料,最后重置了密码.下面,分享下具体操作过程. 1.重新启动虚拟机,在出现启动进度条时按 ...

  9. ln 软链

    ln -s a b 中的 a 就是源文件,b是链接文件名,其作用是当进入b目录,实际上是链接进入了a目录 如上面的示例,当我们执行命令   cd /gamestat/的时候  实际上是进入了 /hom ...

  10. linux下安装python3(转)

    一.Linux下安装Python 二.Linux下Python安装完成后如何使用pip命令 三.Linux下Python安装完成后如何使用yum命令 四.Linux下安装Anaconda 五.Linu ...