天天看点

python升级pip_Python安装升级pip

Python安装升级pip

#!/usr/bin/env python

#coding:utf-8

import os

import tarfile

setuptools_url='https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz --no-check-certificate'

pip_url='https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz --no-check-certificate'

tools_package = 'setuptools-0.6c11.tar.gz'

pip_package = 'pip-9.0.1.tar.gz'

tools_dirname = 'setuptools-0.6c11'

pip_dirname = 'pip-9.0.1'

url = [ setuptools_url,pip_url]

package = [tools_package,pip_package]

package_path = os.getcwd()

for u in url:

os.system('wget -c %s' % url)

for p in package:

abs_package_name = os.path.join(package_path,p)

t=tarfile.open(abs_package_name,'r')

t.extractall()

t.close()

tools_dir = os.path.join(package_path,tools_dirname)

pip_dir = os.path.join(package_path,pip_dirname)

os.chdir(tools_dir)

os.system('python setup.py install')

os.chdir(pip_dir)

os.system('python setup.py build && python setup.py install && pip install --upgrade pip')

©著作权归作者所有:来自51CTO博客作者yht_1990的原创作品,如需转载,请注明出处,否则将追究法律责任

python升级pip_Python安装升级pip

yht_1990

396篇文章,115W+人气,14粉丝

运维技术交流