Python No module named pkg_resources
好记性不如烂笔头。
I encountered the same ImportError
today while trying to use pip. Somehow the setuptools
package had been deleted in my Python environment.
To fix the issue, run the setup script for setuptools
:
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
(or if you don't have wget
installed (e.g. OS X), try
curl https://bootstrap.pypa.io/ez_setup.py | python
possibly with sudo
prepended.)
If you have any version of distribute
, or any setuptools
below 0.6, you will have to uninstall it first.*
See Installation Instructions for further details.
* If you already have a working distribute
, upgrading it to the "compatibility wrapper" that switches you over to setuptools
is easier. But if things are already broken, don't try that.
Try these:
# Get rid of them $ python -m pip uninstall -y setuptools $ python -m pip uninstall -y distribute # the next command should FAIL now because the above should be uninstalled $ python -c "import pkg_resources" # reinstall stuff now $ python -m pip install -U --force-reinstall setuptools $ python -m pip install -U --force-reinstall pip # now check things work and are the same $ python -m pip --version $ pip --version $ pip list
referer:
http://bird.so/search?q=No%20module%20named%20pkg_resources
https://github.com/pypa/pip/issues/1800
【版权所有@Sevck 博客地址http://www.cnblogs.com/sevck】 可以转载,注明出处.