【问题标题】:how to clean files compiled by cython extensions如何清理由 cython 扩展编译的文件
【发布时间】:2013-02-07 06:04:56
【问题描述】:

我很少有使用setuptools 构建的cython 扩展:

python setup.py build

我本来希望他们被删除调用:

python setup.py clean --all

但他们不是,你对如何处理这个问题有什么建议吗?

【问题讨论】:

    标签: python cython setuptools


    【解决方案1】:

    (我不确定是不是你想要的)你想删除生成的文件吗?

    FileIO.purge(Path.currentPath() , r".*\.c$")
    FileIO.purge(Path.currentPath() , r".*\.pyd$")
    FileIO.purge(Path.currentPath() , r".*\.pyc$")
    
    def purge(path, pattern):
        for f in os.listdir(path):
            filename = re.search(pattern, f) 
            if filename is None:
                pass
            else:
                os.remove(os.path.join(path, f))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-09
      • 2018-04-25
      • 2015-09-08
      • 2023-03-16
      • 2012-05-25
      • 1970-01-01
      • 2023-03-08
      相关资源
      最近更新 更多