python自动安装pip
更新时间:2014年04月24日 10:04:51 作者:
这篇文章主要介绍了python自动安装pip的示例,需要的朋友可以参考下
如果是windows安装完成后,需要将'\Python27\Scripts\'加入系统环境变量
复制代码 代码如下:
# coding=utf-8
import os
import urllib2
url='https://raw.github.com/pypa/pip/master/contrib/get-pip.py'
print 'load begin,please waite'
response=urllib2.urlopen(url)
with open('./download.py','w') as f:
f.write(response.read())
print 'load end'
import download
download.main()
print 'clear up'
filepath=['./download.py','./download.pyc']
try:
for path in filepath:
os.remove(path)
except :
pass
print 'insall pip success,please add \'\Python27\Scripts\' to u enveronment path'
相关文章
Python 格式化输出字符串的方法(输出字符串+数字的几种方法)
字符串格式化输出是python非常重要的基础语法,这篇文章主要介绍了Python 格式化输出字符串(输出字符串+数字的几种方法)的方法,需要的朋友可以参考下2023-03-03
最新评论