diff --git a/setup.py b/setup.py
index 7c5d56b2eabc6421745b5757329103ec8326bf48..2118a7757d45318f3c45fcc97ed545d481f33be4 100644
--- a/setup.py
+++ b/setup.py
@@ -91,8 +91,8 @@ class BuildExtWithoutPlatformSuffix(build_ext):
         return get_ext_filename_without_platform_suffix(filename)
 
 def check_tcl_version():
-    output = subprocess.check_output("echo \"puts \$tcl_version;exit 0\" | tclsh", shell=True)
     try:
+        output = subprocess.check_output("echo \"puts \$tcl_version;exit 0\" | tclsh", shell=True)
         val = float(output)
     except (TypeError,ValueError):
         val = None