Python学习记录

Python的创始人为
吉多·范罗苏姆
(Guido van Rossum)
Python(英国发音:/ˈpaɪθən/ 美国发音:/ˈpaɪθɑːn/),是一种面向对象、直译式的电脑程序语言。它包含了一组功能完备的标准库,能够轻松完成很多常见的任务。它的语法简单,与其它大多数程序设计语言使用大括号不一样,它使用缩进来定义语句块。
与Scheme、Ruby、Perl、Tcl等动态语言一样,Python具备垃圾回收功能,能够自动管理内存使用。它经常被当作脚本语言用于处理系统管理任务和网络程序编写,然而它也非常适合完成各种高级任务。Python虚拟机本身几乎可以在所有的操作系统中运行。使用一些诸如py2exe、PyPy、PyInstaller之类的工具可以将Python源代码转换成可以脱离Python解释器运行的程序。
Python的官方解释器是CPython,该解释器用C语言编写,是一个由社区驱动的自由软件,目前由Python软件基金会管理。
Python支持命令式程序设计、面向对象程序设计、函数式编程、面向侧面的程序设计、泛型编程多种编程范式。
SQLAlchemy 如何更新数据库
2018年07月10日
最近修改了模型,没有更新数据库,提交数据报错,具体报错内容如下:sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1054, "Unknown column 'body' in 'field list'") [SQL: 'INSERT INTO article (title, body, body_html...
AttributeError: Neither 'ColumnClause' object nor 'Comparator' object has an attribute 'dispatch'
2018年07月06日
最近在使用Python SQLAlchemy的时候报如下错误:AttributeError: Neither 'ColumnClause' object nor 'Comparator' object has an attribute 'dispatch'看了一下代码:# 文章相关表 class Article(db.Model): __tablename__ = 'article' ...
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-ow5feu0g/pycurl/
2018年07月05日
最近要在服务器上面部署一个应用程序,但是安装的时候出现了一下问题:(venv) root@vps6:/var/pppoe-server# pip install pycurl Collecting pycurl Downloading https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52...
from flask.ext.pagedown import PageDown
2018年07月05日
最近使用python的时候,需要用到pagedown,安装之后报如下错误:Usage: python -m flask run [OPTIONS] Error: While importing "manage", an ImportError was raised: Traceback (most recent call last): File "E:\Python\SMS_Re...
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
2018年07月05日
I wanted to install scrapy in virtualenv using pip (Python 3.5) but I get the followingerror: command 'x86_64-linux-gnu-gcc' failed with exit status 1I tried with Python 2.7 but I get the same errorfo...
代理服务器设置
2018年07月05日
最近需要架设一台代理服务器,使用混播技术,动态改变ip,具体操作如下:安装虚拟环境:yum install python-virtualenv切换目录:cd /var/pppoe-server/创建目录内的虚拟环境:virtualenv venv -p /usr/bin/python3
ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory
2018年07月01日
最近要在服务器上面安装一个MySQL数据库,报了无数个错误之后终于安装上了,但是网站又报错了。应该是在安装的时候,关于MySQL的什么文件删除了。主要错误内容如下:ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory出现这个问题的主要原因:找不到libmysqlcli...
attributeerror: module 'websocket' has no attribute 'enabletrace'
2018年06月29日
最近在使用websocket的时候,报如下错误:attributeerror: module 'websocket' has no attribute 'enabletrace'出现这个错误的原因是:没有安装websocket-client解决方案:安装websocket-client,执行如下命令:pip install websocket-client之后再次运行,问题解决。参考资料:Attr...