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