diff --git a/command/install_lib.py b/command/install_lib.py
index <HASH>..<HASH> 100644
--- a/command/install_lib.py
+++ b/command/install_lib.py
@@ -80,7 +80,8 @@ class install_lib(Command):
         if not isinstance(self.optimize, int):
             try:
                 self.optimize = int(self.optimize)
-                assert self.optimize in (0, 1, 2)
+                if self.optimize not in (0, 1, 2):
+                    raise AssertionError
             except (ValueError, AssertionError):
                 raise DistutilsOptionError, "optimize must be 0, 1, or 2"
removing the assert statement so the code works when Python is run with -O