This cannot be right, as sys.prefix is a string, and so does not have a decode method in Python 3. (The fact that it might work on Python 2 is an accident of the dual bytes/string nature of the str type in Python 2, but conceptually the code is still wrong here.)