摘要: shape函数是numpy.core.fromnumeric中的函数,它的功能是读取矩阵的长度,比如shape[0]就是读取矩阵第一维度的长度。它的输入参数可以使一个整数表示维度,也可以是一个矩阵。 阅读全文
posted @ 2018-07-28 11:30 bioamin 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Python默认是以ASCII作为编码方式的,如果在自己的Python源码中包含了中文(或者其他非英语系的语言),此时即使你把自己编写的Python源文件以UTF-8格式保存了,但实际上,这依然是不行的。解决办法很简单,只要在文件开头加入下面代码就行了 # -*- coding: UTF-8 -*- 阅读全文
posted @ 2018-07-28 09:23 bioamin 阅读(926) 评论(2) 推荐(1) 编辑
摘要: 我的虚拟机是centos6.5,自带python2.6;安装了Python2.7(安装了pip管理工具)后,在python2.7命令行模式下,左右键及退格键无法使用,基于以上情况,我进行了百度: 第一个方法失败: 安装成功了,但是依然不能用; 第二个方法成功: 先安装readline-devel 再 阅读全文
posted @ 2018-05-05 01:04 bioamin 阅读(412) 评论(0) 推荐(0) 编辑
摘要: 3台虚拟机都是20G磁盘,用着用着发现不够了,先扩容了一台,各种百度...各种坑,每个人的情况不一样,发现不一样的地方最后立即百度查看。一台扩容成功后,打算再扩容一台,目的是留一个记录。(我是用xshell超级用户链接的的虚拟机) 扩容大致分为3步:1.外部设置;2.设置分区;3.重启;4挂载;(挂 阅读全文
posted @ 2018-04-28 14:47 bioamin 阅读(936) 评论(0) 推荐(0) 编辑
摘要: import matplotlib import matplotlib.pyplot as plt fig=plt.figure() #交互式测试,此时报错 解决办法,在引用后添加下面这一行 matplotlib.use('Agg') 例如 import matplotlib matplotlib. 阅读全文
posted @ 2018-04-27 17:04 bioamin 阅读(5194) 评论(0) 推荐(0) 编辑
摘要: 1..安装Development Tools yum groupinstall -y 'development tools' 2.安装SSL、bz2、zlib来为Python的安装做好准备工作 yum install -y zlib-devel bzip2-devel openssl-devel x 阅读全文
posted @ 2018-04-26 21:12 bioamin 阅读(1651) 评论(0) 推荐(0) 编辑
摘要: 找不大 eth0网卡,也就连不上网络,症状是ifconfig以后只现实lo,不显示eth0 ifconfig,显示的ip是ifcfg-lo的ip 解决办法 1. 拷贝cp ifcfg-lo ifcfg-eth0 2. 重新配置ifcfg-eth0如下 DEVICE="eth0" BOOTPROTO= 阅读全文
posted @ 2018-04-19 00:57 bioamin 阅读(2405) 评论(0) 推荐(0) 编辑
摘要: ip定位数据大约12M,采用-chacheFile 分发 文件来源https://pan.baidu.com/s/1J0pwTafHgt4T0k3vV_gC-A 格式大致格式如下: 0.0.0.0 0.255.255.255 NULL IANA保留地址 NULL 1.0.0.0 1.0.0.255 阅读全文
posted @ 2018-04-16 20:23 bioamin 阅读(687) 评论(0) 推荐(0) 编辑
摘要: # 数字 ==> ip # 数字范围[0, 255^4] >>> num2ip = lambda x: '.'.join([str(x/(256**i)%256) for i in range(3,-1,-1)]) >>> num2ip(3232235521) '192.168.0.1' # ip ==> 数字 >>> ip2num = lambda x:sum([256**j*int(i)... 阅读全文
posted @ 2018-04-16 19:10 bioamin 阅读(618) 评论(0) 推荐(0) 编辑
摘要: 最近开发学习Pyton,当加入中文注释时,运行程序报错: File "red.py", line 10 SyntaxError: Non-ASCII character '\xe5' in file red.py on line 10, but no encoding declared; see h 阅读全文
posted @ 2018-04-16 15:53 bioamin 阅读(15571) 评论(0) 推荐(0) 编辑