本文整理汇总了Python中pip.py方法的典型用法代码示例。如果您正苦于以下问题:Python pip.py方法的具体用法?Python pip.py怎么用?Python pip.py使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip
的用法示例。
在下文中一共展示了pip.py方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: import pip [as 别名]
# 或者: from pip import py [as 别名]
def setup(self, data):
if not data:
# It's safe to use ensurepip.
print("Installing pip...")
try:
import ensurepip
ensurepip.bootstrap()
except PermissionError:
# panic and try and sudo it
sudo_check_call("python3.5 -m ensurepip")
return
# Instead, we have to run get-pip.py.
print("Installing pip...")
try:
sudo_check_call(["python3.5", "{}".format(data)])
except FileNotFoundError:
subprocess.check_call(["python3.5", "{}".format(data)])
示例2: apply_vagrant_workaround
# 需要导入模块: import pip [as 别名]
# 或者: from pip import py [as 别名]
def apply_vagrant_workaround():
"""
Function which detects if the script is being executed inside vagrant and if it is, it deletes
"os.link" attribute.
Note: Without this workaround, setup.py sdist will fail when running inside a shared directory
(nfs / virtualbox shared folders).
"""
if os.environ.get('USER', None) == 'vagrant':
del os.link
示例3: pip_main
# 需要导入模块: import pip [as 别名]
# 或者: from pip import py [as 别名]
def pip_main(argv):
# Extract the certificates from the PAR following the example of get-pip.py
# https://github.com/pypa/get-pip/blob/430ba37776ae2ad89/template.py#L164-L168
cert_tmpdir = tempfile.mkdtemp()
cert_path = os.path.join(cert_tmpdir, "cacert.pem")
atexit.register(lambda: shutil.rmtree(cert_tmpdir, ignore_errors=True))
with open(cert_path, "wb") as cert:
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
argv = ["--isolated", "--disable-pip-version-check", "--cert", cert_path] + argv
return pip.main(argv)
示例4: download
# 需要导入模块: import pip [as 别名]
# 或者: from pip import py [as 别名]
def download(self):
# Try and use ensurepip.
try:
import ensurepip
return False
except ImportError:
# Download `get-pip.py`.
# We hope we have urllib.request, otherwise we're sort of fucked.
f = tempfile.NamedTemporaryFile(delete=False)
f.close() # we only want the name
print("Downloading pip...")
urlretrieve(GET_PIP, f.name)
return f.name