python 自动下载 moudle
来源:互联网 发布:海马软件删不掉 编辑:程序博客网 时间:2024/05/16 13:59
import sys,re,subprocess
import osfrom subprocess import CalledProcessErrornew_set = set()ls = set()def dls(): temp_set = set() a = subprocess.check_output("ls -R", shell=True) for line in a.split('\n'): str = re.sub(r'.py', r'', line) if str.find('.')<0 and str!='\n' : temp_set.add(str) print str return temp_set def dpip(new_set): ls = dls() for str in new_set-ls: str = str.replace('\n','') with open('daicy.py', 'w') as f: f.write('import '+str) try: a = subprocess.check_call('python daicy.py', shell=True) if a!=0: command = 'pip install '+str print command subprocess.call(command, shell=True) except CalledProcessError, e: print 'except:', e command = 'pip install '+str print command os.system(command) finally: passa = subprocess.Popen('''find -name '*.py' | xargs grep -h -o -w -s "^import\s\+\([\_0-9a-zA-Z]\+\)\|^from\s\+\([\_0-9a-zA-Z]\+\)"''', shell=True,stdout=subprocess.PIPE)for line in a.stdout.readlines(): line = line.replace('\n','') new_set.add(re.sub(r'import\s+|from\s+', r'', line))dpip(new_set)
0 0
- python 自动下载 moudle
- python hashlib moudle
- python自动下载图片
- python lockfile no moudle named LockFile issue
- 将安卓驱动编译成moudle开机后自动启动
- 自动下载并保存博客 Python脚本
- 用python自动下载妹子图
- Python爬虫_自动下载图片
- Python脚本实现自动下载apk文件
- windos自动下载setuptools的Python脚本
- Web Moudle
- 自动下载解压的python logging download os ,一份比较好的python下载解压代码
- 关于python scrapy的安装一个问题 No Moudle named cssselect
- 转载:用Python编写自动下载网络小说的脚本
- 写个Python脚本每天自动下载VOA录音
- 豆瓣电台加心歌曲自动下载(python实现)
- python自动下载人人所有好友的相册
- python爬虫自动搜索下载游民今日搞笑图集
- HDU 1392 Surround the Trees
- 整数溢出的危害和预防
- thinkphp验证码类修改,可自适应改变文字大小
- 网络流题集转自夏天的风
- uva 1529 - Clock(数论)
- python 自动下载 moudle
- 一条SQL语句求每月连续低温时间
- 【Cookie:默认存储在浏览器的内存中】显示上一次访问时间、商品浏览记录
- MFC自动识别串口
- 九度 1050 哈工大 2010 复试上机
- 用原生js实现jquery ajax
- POJ2653 Pick-up sticks
- 简单使用:git下载、修改和上传
- UVa 843 Crypt Kicker