You might think that simply adding to your root path would work. But for Amazon Linux 2 you must add to your /etc/sudoers secure_path variable. For example: secure_path add /usr/local/bin which is conspicuously missing.
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Becomes:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
I need this cuz “sudo pip –version” return sudo: pip: command not found – and adding this to root’s PATH variable would not pick it up.