
python学习笔记
文章平均质量分 65
TanH.blog
这个作者很懒,什么都没留下…
展开
-
The current process just got forked. Disabling parallelism to avoid deadlocks.To disable this warnin
The current process just got forked. Disabling parallelism to avoid deadlocks...To disable this warning, please explicitly set TOKENIZERS_PARALLELISM=(true | false)原创 2022-03-09 10:51:27 · 10017 阅读 · 2 评论 -
导入matplotlib.pyplot as plt画图问题Matplotlib created a temporary config/cache directory at /tmp/matplotl
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-4c7itqfv because the default path (/home/xx/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable direct原创 2022-03-09 10:24:03 · 4499 阅读 · 0 评论 -
git commit 代码提交规范
git commit 代码提交规范一、为什么需要制定提交规范?在团队协作开发时,每个人提交代码时都会写 commit message。每个人都有自己的书写风格,翻看我们组的git log, 可以说是五花八门,十分不利于阅读和维护。一般来说,大厂都有一套的自己的提交规范,尤其是在一些大型开源项目中,commit message 都是十分一致的。因此,我们需要制定统一标准,促使团队形成一致的代码提交风格,更好的提高工作效率,成为一名有追求的工程师。二、业界通用的 git 提交规范有哪些?转载 2021-06-07 10:14:40 · 1045 阅读 · 0 评论 -
get_encoders() got an unexpected keyword argument ‘use_adapter‘
运行环境:tensorflow-gpu == 1.14.0keras==2.2.4keras-bert==0.69.0使用keras-bert的加载bert预训练模型时报错:原因分析:这是keras-transformer版本问题,pip安装keras-bert==0.69.0时自动安装了keras-transformer ==0.38.0(pip list可以查看一下版本)keras-transformer版本改成0.31.0就可以了解决步骤:1. 卸...原创 2020-11-30 10:03:27 · 2456 阅读 · 1 评论 -
elasticsearch 在 python 中的增删改查,批量入库操作以及各种查询的详细使用demo(github可获取源代码)
elasticsearch 在 python 中的使用demogithub网址可获取源代码实现增删改查, 以及批量入库, match、multi_match和复合查询、helpers scan查询方法。更多查询方法以及代码实现请查看Python-ElasticSearch搜索查询的全部详解一、运行条件:1.elasticsearch安装elasticsearch在ubuntu中的docker安装与启动,非常简单。https://blog.youkuaiyun.com/Thanours/artic原创 2020-11-17 10:36:28 · 572 阅读 · 1 评论 -
python使用pip安装模块出现ReadTimeoutError: HTTPSConnectionPool
使用pip安装第三库时,有时会报错:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.这时可以换成国内源:pip install -i https://pypi.tuna.tsinghu...原创 2019-09-26 10:15:33 · 1540 阅读 · 1 评论 -
python错误:TypeError: cannot serialize '_io.TextIOWrapper' object
TypeError: cannot serialize '_io.TextIOWrapper' object这个错误是使用python的内置pickle模块保存一个类对象出现的,由字面意思是无法序列化 '_io.TextIOWrapper'对象。百度了好多次都没有找到解决方法。后面在gihub中找到一条评论https://github.com/hyperopt/hyperopt-sklea...原创 2019-08-01 20:44:01 · 13318 阅读 · 0 评论 -
python如何查看已经安装了的所有模块
一、help('modules')如图:二、pip list原创 2018-11-18 21:00:29 · 9273 阅读 · 0 评论 -
Python界面生成器wxFormBuilder简单使用入门教程
python的桌面UI设计和处理,使用wxPython + wxFromBuilder是一个相对简单的方案。1.下载 用pip install wxpython下载最新的wxPython。2.下载wxfrombuilderwxFormBuilder下载链接,这个是直接用来拖拽用的。3.打开wxformbuilder,1.先点forms里面的Frame,开始的时候必...原创 2018-11-06 17:50:34 · 39686 阅读 · 8 评论 -
pandas库的开发参考指南官方网址
python数据分析库pandas库的开发参考指南官方网址:http://pandas.pydata.org/pandas-docs/stable/dsintro.html原创 2018-10-24 17:26:15 · 950 阅读 · 0 评论 -
python中使用csv模块写入数据时总有空一行的解决办法
我们使用csv模块写入数据到csv文件中时,无论是使用writerow()方法还是writerows(),csv文件中的每一行数据总是相隔一空行import csvdata = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]with open('data.csv', 'w') as f: writer = csv.writer(f...原创 2018-10-31 10:29:13 · 3834 阅读 · 2 评论 -
python的requests库爬虫登录12306铁路网
本文使用python的第三方库requests实现12306网的登录以及验证码的提交功能。本次操作是手动输入验证码,并不是自动识别提交验证码,因为自动识别提交验证码需要用到图像处理与模式识别,还没学到这方面的知识。实现步骤:1.创建会话session,如果单单使用requests.get()和post()等等方法是无法实现登录的。因为直接使用requests.get()方法执行后,没有...原创 2018-10-31 10:12:30 · 1979 阅读 · 0 评论 -
python的numpy库中的矩阵数组的常用函数
一、基本运算ndarray可以进行+,-,*,/,//, %对形状不相似的数组也可以进行运算操作的例:二、ndarray数组的运算方法ndarray.sum([axis,dtype,out,keepdims]) 返回给定轴axis上的数组元素的总和。 没有参数时,默认计算数组所有元素的和 axis:等于0,计算每一列的和 ...原创 2018-10-21 23:41:25 · 1098 阅读 · 0 评论 -
python中numpy库中的ndarray数组初入门
numy参考指南:https://www.numpy.org/devdocs/reference/index.htmlnumy参考指南是官方的,内容很详细,具有权威性。一、ndarray数组的构造1、array():构建一个数组2、arange([start,] stop [,step,] [,dtype]):在给定间隔 [start,stop) 左闭右开的区间内返回均匀间隔s...原创 2018-10-21 13:18:34 · 466 阅读 · 0 评论 -
python 最大递归次数 RuntimeError: maximum recursion depth exceeded
转载出处:点击打开链接帮别人看代码,偶然遇到这个问题,原来python解释器有一个默认的最大递归次数是999。举个例子:def recursion(n): if (n <= 1): return print n recursion(n - 1)print "test 999"recursion(999) #正常运行print "test ...转载 2018-04-15 22:31:30 · 1172 阅读 · 0 评论 -
python各种模块安装whl文件下载网址
https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml下载whl文件回来安装后就可以使用了原创 2018-03-21 22:27:44 · 31329 阅读 · 2 评论