utils.execute_command('sudo rm -rf %s' % self.TMP_FOLDER)
def _remove_package(self, package):
- os.system('%s pip uninstall %s -y' % (self.PYTHONPATH, package))
+ os.system('%s python -m pip uninstall %s -y' %
+ (self.PYTHONPATH, package))
def _list_packages(self):
pip_list_regex = re.compile(
r"(?P<name>[\w\.-]+) \((?P<version>[\w\d_\.\-]+),*.*\)")
+ pip_list_regex_18 = re.compile(
+ r"(?P<name>[\w\.-]+)[\s]+(?P<version>[\w\d_\.\-]+),*.*")
pkg_dict = {}
- pkgs = utils.execute_command('pip list',
+ pkgs = utils.execute_command('python -m pip list',
env={'PYTHONPATH': self.TMP_FOLDER})
for line in pkgs:
match = pip_list_regex.match(line)
+ if not match:
+ match = pip_list_regex_18.match(line)
if match and match.group('name'):
pkg_dict[match.group('name')] = match.group('version')
return pkg_dict