Missing files for `magic` library on Windows

后端 未结 3 1612
栀梦
栀梦 2020-12-31 14:11

I need to get mime type for some files on windows, so i\'ve installed python-magic (on 32-bit python 2.7.3).
It depends on unix magic library.<

3条回答
  •  长情又很酷
    2020-12-31 14:55

    As the python-magic problems seems to be quite common, here a working solution fo future googlers: After testing most solutions without altering the source-code, I found the following to get python-magic working out of the box:

    1. Install GnuWin32 file first
    2. Set the environment variable MAGIC=path\to\gnuwin32\share\misc\magic
    3. Assure all installed executables/libraries to be accessible via the PATH
    4. Install python-magic via pip

提交回复
热议问题