Use "import pip" method of calling pip only as last resort

Doing that poses too much risk with pip's general "no API support", as
seen in #2499.
This commit is contained in:
Gina Häußge committed 2018-03-22 13:59:38 +01:00
1 parent fb834f81ee
commit f10bfa67ca
1 file changed
+5
+5
View File
@@ -11,6 +11,7 @@ import sys
import logging
import site
import threading
import os
import pkg_resources
@@ -237,6 +238,10 @@ class PipCaller(CommandlineCaller):
@classmethod
def autodetect_pip(cls):
commands = [[sys.executable, "-m", "pip"],
[os.path.join(os.path.dirname(sys.executable), "pip.exe" if sys.platform == "win32" else "pip")],
# this should be our last resort since it might fail thanks to using pip programmatically like
# that is not officially supported or sanctioned by the pip developers
[sys.executable, "-c", "import sys; sys.argv = ['pip'] + sys.argv[1:]; import pip; pip.main()"]]
for command in commands: