diff --git a/setup.py b/setup.py index 5645708a4ca..28251cdf0df 100644 --- a/setup.py +++ b/setup.py @@ -463,7 +463,8 @@ def build_extension(self, ext: _BaseExtension) -> None: dst_file: Path = ext.dst_path(self) # Ensure that the destination directory exists. - self.mkpath(os.fspath(dst_file.parent)) + if not dst_file.parent.exists(): + self.mkpath(os.fspath(dst_file.parent)) # Copy the file. self.copy_file(os.fspath(src_file), os.fspath(dst_file))