python代码
__浮生若梦__
这个作者很懒,什么都没留下…
展开
-
修改pip源为国内源
修改pip源为国内源1、windows环境下,在用户目录新建pip\pip.ini,编辑内容为 (例如:C:\Users\zhou\pip\pip.ini)[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple2、linux环境下,编辑~/.pip/pip.conf,编辑内容为[global]index...原创 2017-11-12 09:21:19 · 725 阅读 · 0 评论 -
python时间格式化操作
python时间格式化操作时间表示形式1、获得当前时间的时间戳(自1970至今的秒数),类型浮点型>>> import time>>> time.time()1510638986.3258848>>> type(time.time())<class 'float'>2、获得当前时间的本地(UTC + x)时间,类型time.struct_time>>> time.localtime()tim原创 2017-11-14 14:38:25 · 2409 阅读 · 0 评论 -
python远程ssh连接linux
python远程ssh连接linux 1、安装第三方库paramikopip install paramiko2、创建ssh客户端,并连接ssh = paramiko.SSHClient()# 自动认证ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())ssh.connect('192.168.2.54', username = 'tes原创 2017-11-30 09:37:49 · 3985 阅读 · 0 评论 -
python socket服务端客户端示例
python socket服务端客户端示例服务端程序import socket, threading, times = socket.socket()s.bind(("192.168.2.105",1111))s.listen(1)# tcp连接处理函数def tcplink_process(sock, addr): print('New connecti...原创 2018-02-28 11:46:06 · 446 阅读 · 0 评论 -
jupyter notebook安装配置
jupyter notebook安装配置1、linux下pip安装$ pip install jupyter2、生成配置文件$ jupyter notebook --generate-configWriting default config to: /home/xxx/.jupyter/jupyter_notebook_config.py3、编辑配置文件...原创 2018-04-08 14:18:36 · 245 阅读 · 0 评论 -
python虚拟环境创建和激活
python虚拟环境创建和激活1、创建虚拟环境$ mkdir work$ python3 -m venv work/# 查看虚拟环境目录结构$ cd work$ lsbin include lib lib64 pyvenv.cfg share# 查看虚拟环境配置$ vi pyvenv.cfg------------------------------...原创 2018-04-08 14:36:38 · 32672 阅读 · 3 评论