python常用技巧
wwwsctvcom
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python解决ssl certificate problem unable to get local issuer certificate问题
【代码】python解决ssl certificate problem unable to get local issuer certificate问题。原创 2023-11-01 13:37:36 · 419 阅读 · 0 评论 -
pywin32api报错问题
一、报错提示ImportError: DLL load failed while importing win32gui: 找不到指定的模块。解决方案:pywin32==300版本时候提示,将版本改为pywin32==225之后报错消失。原创 2021-02-01 20:45:11 · 316 阅读 · 0 评论 -
Uiautomator2手动安装部分工具
一、需要安装内容app-uiautomator.apk app-uiautomator-test.apk atx-agent minicap minitouch二、自动安装python -m uiautomator2 init三、手动安装1、安装apkwget https://github.com/openatx/android-uiautomator-server/releases/download/$VERSION/app-uiautomator.apkwget ht原创 2020-12-14 10:33:37 · 2267 阅读 · 0 评论 -
windows下安装mmcv报错
一、环境问题报错一:ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.解决:安装pytest-runnerpip install pytest-runner报错二:Command "python setup.py egg_info" failed with error code 1解决:更新pip和setup..原创 2020-11-26 13:12:37 · 3367 阅读 · 4 评论 -
通过conda或者pip安装包时出现There was a problem confirming the ssl certificate报错
一、通过.txt安装package1、pip install -r xxx.txt2、conda install --yes --file xxx.txt二、解决报错参考地址:https://www.itread01.com/content/1542198799.html--trusted-host很重要pip install xlrd -i http://pypi.douban.com/simple --trusted-host pypi.douban.com其他源:1.原创 2020-11-23 10:18:42 · 908 阅读 · 0 评论 -
windows下的pytorch-gpu环境搭建方法
一、配置国内镜像源conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/#必不可少,不然会出现找不到包,或者只有cpu版本的pytorch包conda config --add channels https://mi原创 2020-11-06 20:27:37 · 505 阅读 · 0 评论 -
CondaHTTPError: HTTP 000 CONNECTION FAILED for url错误
操作方法:修改C:\Users\<本机用户名>\.condarc下内容为:channels: - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ssl_verify: trueshow_channel_urls: true且一定要将https改为http!!!原创 2020-09-03 17:18:59 · 149 阅读 · 0 评论 -
Pyinstaller进行手动安装和简单使用方法
背景使用pip或conda无法安装时可通过手动安装的方式进行安装pyinstaller安装下载地址:https://github.com/pyinstaller/pyinstaller/releases,选择需要的版本,建议新版本,打包成功的概率更大!1、解压下载好的文件到python安装目录中Script下:pyinstaller-4.0.tar.gz;2、进入解压后的文件夹中输入命令:python setup.py install;3、完成安装;使用1、进入需..原创 2020-09-03 09:22:09 · 5534 阅读 · 1 评论 -
闭包和装饰器的基本使用
参考地址:https://www.cnblogs.com/paulwhw/p/8683990.html#闭包的定义def outer(): def inner(): print('inner function!') return inneri = outer()#i存储的是inner的地址print(i)#i存储的是inner函数的内存地址i()#调用...原创 2019-09-07 14:59:52 · 175 阅读 · 0 评论 -
求最小公约数和最大公倍数
参考博客:https://blog.youkuaiyun.com/jackfjw/article/details/82469300代码:(1)比较粗暴的方法nums = [18, 15, 30]#最大公约数def hcf(nums): min_val = min(nums) res = 0 if min_val == 1: return 1 ...原创 2019-08-31 14:42:28 · 203 阅读 · 0 评论 -
python中bisect的基本使用方法
bisect包含四个模块:import bisecttest = [1, 2, 6, 8, 19]print(bisect.bisect(test, 2))#返回2的位置,如果不存在则返回左边的值print(bisect.bisect_left(test, 2))#返回6的位置,如果不存在则返回右边的值print(bisect.bisect_right(tes...原创 2019-08-11 16:10:28 · 1948 阅读 · 0 评论 -
itertools常见方法的使用
一、前言本文介绍python标准库itertools,为了方便,直接贴代码实现。二、代码实现1、排列tmp = itertools.permutations([1, 2, 3], 2)print(list(tmp))#[(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)]2、组合tmp = itertools.combinat...原创 2019-08-06 23:57:58 · 305 阅读 · 0 评论 -
python中二叉树、堆、headq模块的基本使用
一、前言这篇文章写的真的很好,忍不住拿来放到自己博客方便后面学习,并且这篇是转载的文章,如果有侵权的会马上删掉,附上原始地址:https://www.cnblogs.com/shijieli/p/10870736.html;二叉树概念二叉树是n(n>=0)个结点的有限集合,该集合或者为空集(称为空二叉树),或者由一个根结点和两棵互不相交的、分别称为根结点的左子树和右子...转载 2019-08-08 20:15:02 · 1033 阅读 · 0 评论 -
python中字典按照键值排序
实现代码:test = {'a':1, 'd':3, 'b':2, 'c':4}#字典的值排序,返回列表val_sort1 = sorted(test.values())#[1, 2, 3, 4]val_sort2 = sorted(test.values(), reverse=True)#[4, 3, 2, 1]#字典的键排序,返回列表key_sort = sorted(te...原创 2019-08-08 14:52:52 · 473 阅读 · 0 评论 -
sklearn机器学习库的基本使用
一、前言本文介绍sklearn机器学习标准库的基本使用,sklearn库封装了大量机器学习算法,在机器学习领域非常的重要,其中会涉及到pandas等其他库的使用,需要自行学习;二、代码实现1、数据集介绍,加载数据包含三种方式,load,fetch,make,这里只加载一种经典的鸢尾花数据集,鸢尾花存储方式为字典;from sklearn.datasets import load_...原创 2019-08-08 00:21:50 · 657 阅读 · 0 评论
分享