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:
1 parent
fb834f81ee
commit
f10bfa67ca
1 file changed
+5
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user