We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7814d1c commit e703620Copy full SHA for e703620
src/pip/_internal/commands/install.py
@@ -227,11 +227,11 @@ def add_options(self):
227
@with_cleanup
228
def run(self, options, args):
229
# type: (Values, List[str]) -> int
230
- try: # Unix
+ if sys.platform == 'darwin' or sys.platform == 'linux': # Unix
231
is_su = os.getuid() == 0 # type: ignore
232
- except AttributeError: # Windows
+ elif sys.platform == 'win32' or sys.platform == 'cygwin': # Windows
233
is_su = ctypes.windll.shell32.IsUserAnAdmin() != 0 # type: ignore
234
- except Exception: # Unknown
+ except AttributeError: # Unknown
235
is_su = False
236
if is_su:
237
sudo_warning = ("Running pip as root is not recommended. "
0 commit comments