【问题标题】:Why is Module python-magic not available?为什么模块 python-magic 不可用?
【发布时间】:2019-12-21 00:44:06
【问题描述】:

我正在使用 s3cmd 从 Mac 同步到 S3 存储桶,我收到以下警告:

WARNING: Module python-magic is not available. Guessing MIME types based on file extensions.

pip list 显示python-magic 实际上已安装。

Package      Version
------------ -------
pip          19.3.1 
python-magic 0.4.15 
setuptools   42.0.2 
wheel        0.33.6 

python --version 显示

Python 3.7.5

还有pip --version 显示

pip 19.3.1 from /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)

我该如何解决这个问题?

【问题讨论】:

    标签: python pip s3cmd python-magic


    【解决方案1】:

    通过在命令行中运行 python -c 'import magic' 来验证 import magic(在 s3cmd 中失败的代码)是否有效。

    如果没有,您可能需要安装 libmagic。试试brew install libmagic

    【讨论】:

      【解决方案2】:

      在s3cmd手册中,有一个参数:--no-mime-magic。如果你使用它,没有警告。

      ./s3cmd --help | grep magic 
      

      使用这个命令你会找到它。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-09-24
        • 2014-04-11
        • 2015-07-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-06-10
        • 2012-03-07
        相关资源
        最近更新 更多