在 Google Colab 中尝试 install/use Python-Magic 时出错
Error in trying to install/use Python-Magic in Google Colab
我正在尝试在 Colab 中安装 python-magic。这里是图书馆的Githubhttps://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 post 说
Exception Value:failed to find libmagic. Check your installation in windows 7
Your multiuploader form uses python-magic library possibly for filetype identification. However you probably do not have all the missing dependencies installed. Please install the missing dependencies.
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 post
pip installing eyeD3 module. Failed to find libmagic
我试过了
pip install python-magic-bin==0.4.14
我也试过了
!brew install libmagic
但 Colab 似乎无法识别 brew
在Colab上安装Libmagic的方式如下:
!apt-get install libmagic-dev
!pip install python-magic
那么,导入就没有问题了:
import magic
我正在尝试在 Colab 中安装 python-magic。这里是图书馆的Githubhttps://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 post 说 Exception Value:failed to find libmagic. Check your installation in windows 7
Your multiuploader form uses python-magic library possibly for filetype identification. However you probably do not have all the missing dependencies installed. Please install the missing dependencies. 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 post
pip installing eyeD3 module. Failed to find libmagic
我试过了
pip install python-magic-bin==0.4.14
我也试过了
!brew install libmagic
但 Colab 似乎无法识别 brew
在Colab上安装Libmagic的方式如下:
!apt-get install libmagic-dev
!pip install python-magic
那么,导入就没有问题了:
import magic