Python
L(刘二宝)
学习 分享
展开
-
Pycharm解决tensorflow2.0中Cannot find reference '***' in '__init__.py'无法查看源码问题
Cannot find reference 'AdditiveAttention' in '__init__.py' less... (Ctrl+F1)Inspection info: This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing,...原创 2020-04-22 13:17:35 · 4831 阅读 · 2 评论 -
腾讯云Linux环境部署flask web项目(linux+uwsgi+nginx)
环境准备1、安装python环境参见《Linux系统安装Python3环境(超详细)》安装好python环境2、安装pip命令执行easy_installpip命令即可安装pip,easy_install在已安装的python根目录bin下,如果是Python 3.6.5版本,执行easy_install-3.6pip3、安装flask执行...原创 2019-04-28 23:18:04 · 1598 阅读 · 4 评论 -
(pymysql.err.OperationalError) (2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pipe'
这里记录下uwsgi部署flask web程序时,uwsgi进程活着,无法访问flask web的情况,后台使用了数据库持久层框架sqlalchemy,通过查看日志,看到日志报错如下:(pymysql.err.OperationalError) (2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pip...原创 2019-05-02 09:33:03 · 6618 阅读 · 2 评论 -
configparser.NoSectionError: No section: 'mysql'
ConfigParser跨目录读取配置文件,报错如下:configparser.NoSectionError: No section: 'mysql'使用绝对路径import ospath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))print(path)cp = ConfigParser(...原创 2019-04-17 22:41:02 · 5096 阅读 · 0 评论 -
模拟登录(Python)
"""模拟登录"""import requestsfrom lxml import etreeEMAIL = '********'PASSWORD = '********'class Login(object): def __init__(self): self.session = requests.Session() self.head...转载 2019-01-14 18:58:00 · 1996 阅读 · 1 评论 -
Python3无法安装turtle问题
问题执行pip3 install turtle命令安装turtle时,错误如图:发现在setup.py包的第40行 except ValueError, ve处有错,Python2中是可以这样写的,但在Python3中多个异常需要放在小括号中。解决方法根据错误信息中的给定的地址,下载turtle(开始下载),解压后,打开setup.py,将第40行代码修改为:...原创 2019-01-19 13:08:11 · 12623 阅读 · 19 评论 -
Python编码规范(Style Guide for Python Code)
参考原文《Style Guide for Python Code》。Guido:“code is read much more often than it is written”缩进每个缩进级别使用四个空格。函数正例:函数调用时多个参数分多行书写,第一种方式,参数需要对齐:foo = long_function_name(var_one, var_two, ...翻译 2019-01-07 14:14:29 · 3188 阅读 · 1 评论 -
验证码识别(Python)
图形验证码识别 图形验证码最早出现,也很常见,一般由4个字母或者数字组成。例如,中国知网注册页面采用的就是图形验证码,链接为http://my.cnki.net/elibregister/commonRegister.aspx,页面如下:该注册页面表单最后一项就是图形验证码,必须正确输入图形验证码才可以完成注册。该图形验证码其实是一张图片,上面是经过变形的4个大写字母,并...原创 2019-01-10 13:06:13 · 1201 阅读 · 0 评论 -
Python3 numpy .T/transpose/swapaxes数组转置详解
1、numpy中的数组(1)数组维数import numpy as nparr1d = np.arange(24).reshape(24)print('一维数组:', arr1d)arr2d = np.arange(24).reshape((4, 6))print('二维数组:\n', arr2d)arr3d = np.arange(24).reshape(2, 3, 4...原创 2018-12-07 15:27:59 · 6801 阅读 · 1 评论 -
Python中的容器(container)、迭代器(iterator)和生成器(generator:yield)
1、容器迭代器iterator 以list容器(tuple,range,file类似)为例,list容器可以调用自己的__iter__()方法获取用来迭代自己内部元素的迭代器。例如:# list容器myList = [1, 2, 3]# 获取list容器的迭代器it = myList.__iter__() 示例中首先给出了一个myList容器对象,内部存放了3个整数,该容器对象...原创 2018-12-06 15:50:14 · 1547 阅读 · 0 评论 -
Linux系统安装Python3环境(超详细)
本文基于如下Linux系统版本:1、默认情况下,Linux会自带安装Python,可以运行python --version命令查看,如图:我们看到Linux中已经自带了Python2.7.5。再次运行python命令后就可以使用python命令窗口了(Ctrl+D退出python命令窗口)。2、查看Linux默认安装的Python位置看到/usr/bin/python...原创 2018-12-05 14:31:15 · 222479 阅读 · 78 评论 -
Python3安装Mysql驱动包PyMySQL
1、下载PyMySQL包登录https://pypi.org/网站,输入pymysql,搜索PyMySQL包,如图:搜索后结果如图: 点击搜索结果PyMySQL 0.9.2后,如图:然后点击Download files,页面如图: 点击whl格式的文件下载。 2、安装PyMySQL包在Python安装目录下,新建一个whl目录(以后可以专门用来放置w...原创 2018-12-08 00:33:08 · 3381 阅读 · 0 评论