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

转载于:https://www.cnblogs.com/sevck/p/7754597.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值