<p>Python使用filetype精确判断文件类型 (文件类型获取),今天在安装filetype提示报错:"ImportError: No module named 'filetype'"。</p><p>执行</p><pre class="brush:python;toolbar:false">pip install filetype</pre><p>提示:"You should consider upgrading via the 'python -m pip install --upgrade pip' command."</p><p>执行</p><pre class="brush:python;toolbar:false">python -m pip install --upgrade pip</pre><p>还是不行,然后去网上找了下资料,最终找到解决办法如下:</p><blockquote><p>Your Python is 2.7, yet you're using the pip from 3.5! A module is not installable with only setup.py, hence this is all invalid. Use python -mpip to run the pip that is linked to whatever the pythoncommand is pointing to.</p></blockquote><p>了解后就是需要执行一句命令,如下:</p><pre class="brush:python;toolbar:false">python -mpip install filetype</pre><p>完美解决,其它小伙伴都是怎么解决的呢,欢迎小伙伴在下方评论区留下你的方法。</p>