def pip_exact_search(name): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() callable_pip.main('search', name, '--disable-pip-version-check') sys.stdout = old_stdout output = mystdout.getvalue().lower().replace('-', '_') r = re.compile("^{} .*$".format(name), re.I | re.M).search(output) return r is not None
from callable_pip import main try: from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtWebEngineWidgets import * from PyQt5.QtGui import * except ImportError: main(['install', 'PyQt5']) from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtWebEngineWidgets import * from PyQt5.QtGui import * try: import sip except ImportError: main(['install', 'SIP']) import sip import sys import os from functools import partial try: import easygui as gui except ImportError: main(['install', 'easygui']) import easygui as gui eb = gui.exceptionbox import _apps from getpass import getuser from time import time, sleep
def install_python_dependencies(dependencies: List[str]): """ Call pip to install the given python dependencies. :param dependencies: List of python modules to install """ callable_pip.main("install", *dependencies)
def install_package(src, dst): cpip.main('install', src, '--force-reinstall', '--no-cache-dir', '--upgrade', '--target', dst)
def download_package(name, paent_dir): pip.main('download', '-d', f'{paent_dir}{os.sep}{name}', name) return f'{paent_dir}{os.sep}{name}'