我正在尝试在 Colab 中安装 python-magic。这是库的 Github https://github.com/ahupp/python-magic#dependencies
当我尝试:
!pip install python-magic
import magic
这导致
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-44-1461204615fc> in <module>()
1 get_ipython().system('pip install python-magic')
----> 2 import magic
/usr/local/lib/python3.6/dist-packages/magic.py in <module>()
179 if not libmagic or not libmagic._name:
180 # It is better to raise an ImportError since we are importing magic module
--> 181 raise ImportError('failed to find libmagic. Check your installation')
182
183 magic_t = ctypes.c_void_p
ImportError: failed to find libmagic. Check your installation
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
我已经尝试了所有可能的解决方案
这篇 SO 帖子说 Exception Value:failed to find libmagic。检查您在 Windows 7 中的安装
您的 multiuploader 表单可能使用 python-magic 库来识别文件类型。但是,您可能没有安装所有缺少的依赖项。请安装缺少的依赖项。 https://github.com/ahupp/python-magic#dependencies
但是不再列出依赖项。
我也试过
pip install python_magic_bin-0.4.14-py2.py3-none-win_amd64.whl
和
pip install python_magic_bin-0.4.14-py2.py3-none-win32.whl
从这个 SO 帖子
我试过了
pip install python-magic-bin==0.4.14
我也试过
!brew install libmagic
但 Colab 似乎不承认brew