随笔分类 -  Python

摘要:(1)在windows文件管理器中,输入 %APPDATA% (2)会定位到一个新的目录下,在该目录下新建pip文件夹,然后到pip文件夹里面去新建个pip.ini文件 (3)在新建的pip.ini文件中输入以下内容 [global]timeout = 6000index-url = https:/ 阅读全文
posted @ 2018-07-19 21:52 Shiyu_Huang 阅读(780) 评论(0) 推荐(0) 编辑
摘要:wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz tar zxfv Python-3.4.5.tgz ./configure --prefix=$HOME/install_dir make -j32 make install 阅读全文
posted @ 2018-05-17 15:00 Shiyu_Huang 阅读(294) 评论(0) 推荐(0) 编辑
摘要:from sympy.combinatorics.named_groups import DihedralGroup from collections import Counter n = 12 G = DihedralGroup(n) a = list(G.generate_dimino()) for perm in a: ks = [] for k in perm.c... 阅读全文
posted @ 2018-05-05 10:50 Shiyu_Huang 阅读(557) 评论(0) 推荐(0) 编辑
摘要:0.安装 pip install virtualenv 1.创建新的环境 virtualenv --no-site-packages ai 2.进入环境 source ai/bin/activate 3.退出当前环境 deactivate 4.指定python版本 virtualenv -p /us 阅读全文
posted @ 2018-05-01 09:26 Shiyu_Huang 阅读(147) 评论(0) 推荐(0) 编辑
摘要:import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 阅读全文
posted @ 2018-04-19 16:15 Shiyu_Huang 阅读(1225) 评论(0) 推荐(0) 编辑
摘要:1. 2维数组排序 (按照每行第一个数字从小到大进行排序) 阅读全文
posted @ 2018-03-17 11:45 Shiyu_Huang 阅读(222) 评论(0) 推荐(0) 编辑
摘要:1.创建字典 2.按照value值排序 阅读全文
posted @ 2018-03-17 09:37 Shiyu_Huang 阅读(166) 评论(0) 推荐(0) 编辑
摘要:有时候使用cv2需要安装opencv,但是opencv安装比较麻烦,因为需要编译过程。 所以,我们可以使用PIL对cv2的一些常用接口进行复现。 这里我们实现了cv2的imread(), imwrite(), resize(), cvtColor() 共四个接口。 实现代码如下: 阅读全文
posted @ 2018-02-26 20:21 Shiyu_Huang 阅读(2088) 评论(0) 推荐(0) 编辑
摘要:1.读取图片 读取出来的图片是numpy.ndarray格式,值是0~255, img的形状是 (图片高度,图片宽度,图片通道数),打印值出来发现通道的顺序是BGR,而不是RGB。 2.改变图片大小 这个进行大小变换时,需要把指定的图片宽度放在前面,图片高度放在后面,和img的形状大小顺序不一致。 阅读全文
posted @ 2018-02-26 18:42 Shiyu_Huang 阅读(2935) 评论(0) 推荐(0) 编辑
摘要:cd ~mkdir .pip vim .pip/pip.conf 在pip.conf中写入 火山云: [global] timeout = 6000 index-url = https://mirrors.ivolces.com/pypi/simple trusted-host = mirrors. 阅读全文
posted @ 2018-02-18 23:26 Shiyu_Huang 阅读(451) 评论(0) 推荐(0) 编辑
摘要:python test.py --gpu 0 阅读全文
posted @ 2018-02-05 01:58 Shiyu_Huang 阅读(14146) 评论(0) 推荐(0) 编辑
摘要:pip install tqdm 阅读全文
posted @ 2018-01-24 19:43 Shiyu_Huang 阅读(331) 评论(0) 推荐(0) 编辑
摘要:pip install retry 自动尝试5次,每次间隔2秒 阅读全文
posted @ 2018-01-24 19:23 Shiyu_Huang 阅读(8690) 评论(0) 推荐(0) 编辑
摘要:1.用scipy import scipy scipy.misc.imsave('test.jpg', img) 2.用PIL from PIL import Image im = Image.fromarray(img) im.save("test.jpg") 阅读全文
posted @ 2018-01-05 10:33 Shiyu_Huang 阅读(13050) 评论(0) 推荐(1) 编辑
摘要:给一个矩阵,顺时针旋转顺序输出其元素,例如: 对于矩阵: [ 1, 2, 3 ] [ 4, 5, 6 ] [ 7, 8, 9 ] 输出为: 1,2,3,6,9,8,7,4,5 输出为: 阅读全文
posted @ 2017-11-15 13:30 Shiyu_Huang 阅读(17391) 评论(0) 推荐(0) 编辑
摘要:转自:http://www.jb51.net/article/88147.htm 阅读全文
posted @ 2017-11-13 08:11 Shiyu_Huang 阅读(187) 评论(0) 推荐(0) 编辑
摘要:import time print time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) 阅读全文
posted @ 2017-10-29 22:25 Shiyu_Huang 阅读(289) 评论(0) 推荐(0) 编辑
摘要:转自:http://outofmemory.cn/code-snippet/1002/Python-RGB-HSV-color-together-switch Python RGB 和HSV颜色相互转换 import math def hsv2rgb(h, s, v): h = float(h) s 阅读全文
posted @ 2017-09-14 15:52 Shiyu_Huang 阅读(14988) 评论(0) 推荐(0) 编辑
摘要:官网:https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md 环境:ubuntu16, python2.7, Anaconda2 1.首先安装依赖 # ZDoom dependencies sudo apt-get instal 阅读全文
posted @ 2017-07-07 23:06 Shiyu_Huang 阅读(2368) 评论(1) 推荐(0) 编辑
摘要:http://blog.csdn.net/jiandanjinxin/article/details/53175121 阅读全文
posted @ 2017-06-28 17:06 Shiyu_Huang 阅读(222) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示