问题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. Session 与 Token 的区别

    1. 为什么要有session的出现?答:是由于网络中http协议造成的,因为http本身是无状态协议,这样,无法确定你的本次请求和上次请求是不是你发送的.如果要进行类似论坛登陆相关的操作,就实现不了 ...

  2. Log4net 配置文件组成

    Example: <?xml version="1.0" encoding="utf-8" ?><configuration><l ...

  3. 应届生第一次Java面试问题分享

    1.  Java四大域 ServletContext域(Application域): 整个WEB应用 HttpSession域(Session域):一次会话 ServletRequest域(Reque ...

  4. Delphi编程之爬取贴吧多页帖子图片

    接着上一篇文章说一下我们如何爬取多页帖子的图片. 第一步,还是随便找个贴吧,这次我们就找图片相对较少的射雕英雄传吧. 把页面拉到最底下,在页码区域单击右键,选择检查. 在这里我们看到了页码的代码区域, ...

  5. 跟技术胖学vue+koa

    首页热卖商品组件 技术点:1热卖商品封装成单独的组件  2路由和参数的传递  3详情页面路由参数的接收 //首页 <template> <div> <div class= ...

  6. Linux中访问Apache报403错误处理方法

    1.先说本地环境,脱离基础环境的解决策略都是耍流氓 (1)Linux:CentOS7.5 (2)Apache: Apache/2.4.6 (CentOS) (3)Apache的安装路径在 /usr/l ...

  7. Request对象和Response对象 JsonResponse对象 和 Django shortcut functions 和QueryDict对象

    request request属性 属性: django将请求报文中的请求行.头部信息.内容主体封装成 HttpRequest 类中的属性. 除了特殊说明的之外,其他均为只读的. ''' 0.Http ...

  8. Gnome osc,资源,,,,,因为官网难下

    链接:https://share.weiyun.com/5XPLvJz 密码:pygpci

  9. python基础学习1(linux命令)

    读研时转人工智能,机器学习方向,必然要用到python,于是开始自学. 1.环境: 使用linux环境下python编译,熟悉各种基本操作. 2.书籍: --  笨方法学python --   a b ...

  10. knockout为绑定元素生成id

    knockout 提供生成了uniqueName的方法,但没有提供生成Id的方法. 感谢stackoverflow提供的思路与方法. 下面是uniqueName的实现方法. ko.bindingHan ...