diff --git a/distutilscross/crosscompile.py b/distutilscross/crosscompile.py
index 31dfd6c..16b683e 100644
--- a/distutilscross/crosscompile.py
+++ b/distutilscross/crosscompile.py
@@ -13,7 +13,7 @@ class build(_build):
         self.cross_compile = 0
 
     def finalize_options(self):
-        if self.cross_compile and os.environ.has_key('PYTHONXCPREFIX'):
+        if self.cross_compile and 'PYTHONXCPREFIX' in os.environ:
             prefix = os.environ['PYTHONXCPREFIX']
             sysconfig.get_python_lib = get_python_lib
             sysconfig.PREFIX = prefix
@@ -31,8 +31,8 @@ class build(_build):
 
 _get_python_lib = sysconfig.get_python_lib
 def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
-    if os.environ.has_key('PYTHONXCPREFIX'):
-        print "Setting prefix"
+    if 'PYTHONXCPREFIX' in os.environ:
+        print("Setting prefix")
         prefix = os.environ['PYTHONXCPREFIX']
 
     return _get_python_lib(plat_specific, standard_lib, prefix)
@@ -50,24 +50,24 @@ def customize_compiler(compiler):
             sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
                             'CCSHARED', 'LDSHARED', 'SO')
 
-        if os.environ.has_key('CC'):
+        if 'CC' in os.environ:
             cc = os.environ['CC']
-        if os.environ.has_key('CXX'):
+        if 'CXX' in os.environ:
             cxx = os.environ['CXX']
-        if os.environ.has_key('LDSHARED'):
+        if 'LDSHARED' in os.environ:
             ldshared = os.environ['LDSHARED']
-        if os.environ.has_key('CPP'):
+        if 'CPP' in os.environ:
             cpp = os.environ['CPP']
         else:
             cpp = cc + " -E"           # not always
-        if os.environ.has_key('LDFLAGS'):
+        if 'LDFLAGS' in os.environ:
             ldshared = ldshared + ' ' + os.environ['LDFLAGS']
-        if os.environ.has_key('OPT'):
+        if 'OPT' in os.environ:
             opt = os.environ['OPT']
-        if os.environ.has_key('CFLAGS'):
+        if 'CFLAGS' in os.environ:
             cflags = opt + ' ' + os.environ['CFLAGS']
             ldshared = ldshared + ' ' + os.environ['CFLAGS']
-        if os.environ.has_key('CPPFLAGS'):
+        if 'CPPFLAGS' in os.environ:
             cpp = cpp + ' ' + os.environ['CPPFLAGS']
             cflags = cflags + ' ' + os.environ['CPPFLAGS']
             ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
