#!/usr/bin/env python
#
# Hi There!
#
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base85 encoding of a zip file, this zip file contains
# an entire copy of pip (version 23.3.1).
#
# Pip is a thing that installs packages, pip itself is a package that someone
# might want to install, especially if they're looking to run this get-pip.py
# script. Pip has a lot of code to deal with the security of installing
# packages, various edge cases on various platforms, and other such sort of
# "tribal knowledge" that has been encoded in its code base. Because of this
# we basically include an entire copy of pip inside this blob. We do this
# because the alternatives are attempt to implement a "minipip" that probably
# doesn't do things correctly and has weird edge cases, or compress pip itself
# down into a single file.
#
# If you're wondering how this is created, it is generated using
# `scripts/generate.py` in https://github.com/pypa/get-pip.
import sys
this_python = sys.version_info[:2]
min_version = (3, 7)
if this_python < min_version:
message_parts = [
"This script does not work on Python {}.{}".format(*this_python),
"The minimum supported Python version is {}.{}.".format(*min_version),
"Please use https://bootstrap.pypa.io/pip/{}.{}/get-pip.py instead.".format(*this_python),
]
print("ERROR: " + " ".join(message_parts))
sys.exit(1)
import os.path
import pkgutil
import shutil
import tempfile
import argparse
import importlib
from base64 import b85decode
def include_setuptools(args):
"""
Install setuptools only if absent and not excluded.
"""
cli = not args.no_setuptools
env = not os.environ.get("PIP_NO_SETUPTOOLS")
absent = not importlib.util.find_spec("setuptools")
return cli and env and absent
def include_wheel(args):
"""
Install wheel only if absent and not excluded.
"""
cli = not args.no_wheel
env = not os.environ.get("PIP_NO_WHEEL")
absent = not importlib.util.find_spec("wheel")
return cli and env and absent
def determine_pip_install_arguments():
pre_parser = argparse.ArgumentParser()
pre_parser.add_argument("--no-setuptools", action="store_true")
pre_parser.add_argument("--no-wheel", action="store_true")
pre, args = pre_parser.parse_known_args()
args.append("pip")
if include_setuptools(pre):
args.append("setuptools")
if include_wheel(pre):
args.append("wheel")
return ["install", "--upgrade", "--force-reinstall"] + args
def monkeypatch_for_cert(tmpdir):
"""Patches `pip install` to provide default certificate with the lowest priority.
This ensures that the bundled certificates are used unless the user specifies a
custom cert via any of pip's option passing mechanisms (config, env-var, CLI).
A monkeypatch is the easiest way to achieve this, without messing too much with
the rest of pip's internals.
"""
from pip._internal.commands.install import InstallCommand
# We want to be using the internal certificates.
cert_path = os.path.join(tmpdir, "cacert.pem")
with open(cert_path, "wb") as cert:
cert.write(pkgutil.get_data("pip._vendor.certifi", "cacert.pem"))
install_parse_args = InstallCommand.parse_args
def cert_parse_args(self, args):
if not self.parser.get_default_values().cert:
# There are no user provided cert -- force use of bundled cert
self.parser.defaults["cert"] = cert_path # calculated above
return install_parse_args(self, args)
InstallCommand.parse_args = cert_parse_args
def bootstrap(tmpdir):
monkeypatch_for_cert(tmpdir)
# Execute the included pip and use it to install the latest pip and
# setuptools from PyPI
from pip._internal.cli.main import main as pip_entry_point
args = determine_pip_install_arguments()
sys.exit(pip_entry_point(args))
def main():
tmpdir = None
try:
# Create a temporary working directory
tmpdir = tempfile.mkdtemp()
# Unpack the zipfile into the temporary directory
pip_zip = os.path.join(tmpdir, "pip.zip")
with open(pip_zip, "wb") as fp:
fp.write(b85decode(DATA.replace(b"\n", b"")))
# Add the zipfile to sys.path so that we can import it
sys.path.insert(0, pip_zip)
# Run the bootstrap
bootstrap(tmpdir=tmpdir)
finally:
# Clean up our temporary working directory
if tmpdir:
shutil.rmtree(tmpdir, ignore_errors=True)
DATA = b"""
P)h>@6aWAK2msSqRaZ{yyYBb^003nH000jF003}la4%n9X>MtBUtcb8c|B0UO2j}6z0X&KUUXrdqAR!
-6ubz6s0VM$QfAw<4YV^ulDhQoop$MlK*;0e<?$L01LzdVw?IP-tnf*qTlkJj!Mom=viw7qw3H>hK=!
b+JA0oQV`^+*aO7_tw^Cd$4zs{Pl#j>6{|X*AaQ6!2wJ?w>%d+2&1X4Rc!^r6h-hMtH_<n)`omXfA!z
c)+2_nTCfpGRv1uvmTkcug)ShEPeC#tJ!y1a)P)ln~75Jc!yqZE1Gl6K?CR$<8F6kVP)a}pU*@~6k=y
<MFxvzbFl3|p@5?5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TN^b($nQcfW{*RPU7#UCjtvT=S^igMN;V;-El07|4Q9?Yw%VVXtZgwTc<u`|?XMhI!y7|;y
gT0fv33?f&x*?f%DjxdH&FbM=bkI6ku*(|5r%@M`Bb(a4-)H&Co=>nxH@F07r&U?JBYrTr{+glCy@RS
qQaP?rRb??C5Znt|G$+i+GjDq}bsVy_)*g>0<<cJ_GQ&9mOE!Y$m5Njf?Yclr8m|DxR*^zp;fk(3lT}
NLrphFE--X#bkjH*TUO*4>=^U1e)YRXbVV{JDiGNUv%*LS!69B}*pyNAc5yp(M0?`=MKEt0>YFzU?dh
ukWv-6v2>0|XQR000O8(^yqk3?7JMTMPgI11JCh8UO$QaA|NaUukZ1WpZv|Y%gMUX>4R)Wo~vZaCy~Q
OLOD65x(nJU^#~+6O#KlrBtIN^U&<LGV!=(JezE(R9uRLMvN(v3y`+8F8}v*HvkeKDer75m({@%!A7G
WUq1lY^SqZ`QRZx2-4>#*j=XAFCwb2HwP1y;%d{=(ishXss?SX3g>2alXTama^Ss5PI5xFtSy_MnjAQ
z-mgZNJwuiFVnMYZ)y#Iabsak&D-ifqX>_vTKSzVSq!<8k|1n))81<zj>S*vK;Q^WhW*CNgMF3oPPVY
GjbA{&CAuGYz`x9eB`xVZcwWEU+L>8|7<dj}eY?0tiarDe!Ia(KM%8hnS$LiVYGR}00oDVjLB<yBsbI
OC!%_JvvD?f~*lsTvR}Ma#s3|I!tLqltUDKMZ3}O}*tpq8s$AAJyX^lX;OO`=aDY!cvLDNm*y)KZ|!!
f$E@XoRvi^!9*1>GxO_)SBV~+n`8L(6F&1cX#gYO;7~nug7*(HJAi6)jE=lb^R!KEJ~`i~UD+mlfTCh
!4b1WC+M<-P>~@W)GcJ4Cva~FdVfg&imLHoWFGP
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
pip 是一个现代的,通用的 Python 包管理工具。提供了对 Python 包的查找、下载、安装、卸载的功能。 压缩包里有python2.7和python3.9对应的pip版本 [root@064f9ec0a58d workspace]# pip -V pip 20.3.4 from /usr/lib/python2.7/site-packages/pip-20.3.4-py2.7.egg/pip (python 2.7) [root@064f9ec0a58d workspace]# pip3.9 -V pip 23.3 from /workspace/python3.9/lib/python3.9/site-packages/pip (python 3.9)
资源推荐
资源详情
资源评论
收起资源包目录
pip.zip (3个子文件)
get-pip.py 2.51MB
get-pip(1).py 1.82MB
pip-20.3.4.tar.gz 1.46MB
共 3 条
- 1
资源评论
偷学技术的梁胖胖yo
- 粉丝: 522
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功