%set_env should ensure environment variables are bytes on Python 2

Should fix test failures on Python 2 + Windows
Cast environment variable key to bytes for Python 2 as well
Merge pull request #6972 from takluyver/fix-win-envvar-not-str

%set_env should ensure environment variables are bytes on Python 2