當前位置: 首頁>>代碼示例>>Python>>正文


Python pip.py方法代碼示例

本文整理匯總了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)]) 
開發者ID:helionmusic,項目名稱:rhinobot_heroku,代碼行數:20,代碼來源:bootstrap.py

示例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 
開發者ID:StackStorm,項目名稱:st2-auth-backend-ldap,代碼行數:11,代碼來源:dist_utils.py

示例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) 
開發者ID:bazelbuild,項目名稱:rules_python,代碼行數:12,代碼來源:piptool.py

示例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 
開發者ID:helionmusic,項目名稱:rhinobot_heroku,代碼行數:15,代碼來源:bootstrap.py


注:本文中的pip.py方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。