--- setuptools/command/easy_install.py +++ setuptools/command/easy_install.py @@ -1498,8 +1498,13 @@ def is_sh(executable): """Determine if the specified executable is a .sh (contains a #! line)""" try: - fp = open(executable) + fp = open(executable, "rb") magic = fp.read(2) + if sys.hexversion >= 0x3000000: + try: + magic = magic.decode() + except UnicodeDecodeError: + magic = magic.decode("utf_8", "replace") fp.close() except (OSError,IOError): return executable return magic == '#!'