pip安装pkg_resources.DistributionNotFound: pip==9.0.1

本文记录了解决pip安装过程中出现的DistributionNotFound错误的过程,通过安装特定版本的distribute包解决了问题,并最终成功安装了pip 9.0.1。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

pip安装pkg_resources.DistributionNotFound: pip==9.0.1

执行pip命令报错

Traceback (most recent call last):
  File "./pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 2989, in <module>
    working_set.require(__requires__)
  File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 726, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 624, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==9.0.1

应该是缺少pip9.0.1 
执行easy_install pip==9.0.1又报错

Traceback (most recent call last):
  File "/usr/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 2993, in <module>
    parse_requirements(__requires__), Environment()
  File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 624, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.10

再安装distribute包

wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz
cd distribute-0.6.10
python setup.py install
  •  

再次安装pip9.0.1

easy_install pip==9.0.1
  • 1

安装成功

Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/local/python2.7/bin
Installing pip2.7 script to /usr/local/python2.7/bin
Installing pip2 script to /usr/local/python2.7/bin

Installed /usr/local/python2.7/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip==9.0.1
Finished processing dependencies for pip==9.0.1
  •  
yangs@yangs:~$ virtualenv ~/venv/hrlnav --python=python3.6 Running virtualenv with interpreter /usr/bin/python3.6 Using base prefix &#39;/usr&#39; New python executable in /home/yangs/venv/hrlnav/bin/python3.6 Also creating executable in /home/yangs/venv/hrlnav/bin/python Installing setuptools, pkg_resources, pip, wheel... Complete output from command /home/yangs/venv/hrlnav/bin/python3.6 - setuptools pkg_resources pip wheel: Collecting setuptools Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by &#39;ReadTimeoutError("HTTPSConnectionPool(host=&#39;pypi.python.org&#39;, port=443): Read timed out. (read timeout=15)",)&#39;: /simple/setuptools/ Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by &#39;ReadTimeoutError("HTTPSConnectionPool(host=&#39;files.pythonhosted.org&#39;, port=443): Read timed out. (read timeout=15)",)&#39;: /packages/b0/3a/88b210db68e56854d0bcf4b38e165e03be377e13907746f825790f3df5bf/setuptools-59.6.0-py3-none-any.whl Downloading https://files.pythonhosted.org/packages/b0/3a/88b210db68e56854d0bcf4b38e165e03be377e13907746f825790f3df5bf/setuptools-59.6.0-py3-none-any.whl (952kB) Exception: Traceback (most recent call last): File "/home/yangs/venv/hrlnav/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/response.py", line 302, in _error_catcher yield File "/home/yangs/venv/hrlnav/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/response.py", line 384, in read data = self._fp.read(amt) File "/home/yangs/venv/hrlnav/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/filewrapper.py", line 60, in read data = self.__fp.read(amt) File "/usr/lib/python3.6/http/client.py", line 467, in read n = self.readinto(b) File "/usr/lib/python3.6/http/client.py", line 511, in readinto n = self.fp.readinto(b) File "/usr/lib/python3.6/socket.py", line 586, in readinto return self._sock.recv_into(b) File "/usr/lib/python3.6/ssl.py", line 1012, in recv_into return self.read(nbytes, buffer) File "/usr/lib/python3.6/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/lib/python3.6/ssl.py", line 631, in read v = self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 353, in run wb.build(autobuilding=True) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/wheel.py", line 749, in build self.requirement_set.prepare_files(self.finder) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 620, in _prepare_file session=self.session, hashes=hashes) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 821, in unpack_url hashes=hashes File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 659, in unpack_http_url hashes) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 902, in _download_http_url _download_url(resp, link, content_file, hashes) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 603, in _download_url hashes.check_against_chunks(downloaded_chunks) File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/utils/hashes.py", line 46, in check_against_chunks for chunk in chunks: File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 571, in written_chunks for chunk in chunks: File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/utils/ui.py", line 139, in iter for x in it: File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 560, in resp_read decode_content=False): File "/home/yangs/venv/hrlnav/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/response.py", line 436, in stream data = self.read(amt=amt, decode_content=decode_content) File "/home/yangs/venv/hrlnav/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/response.py", line 401, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__ self.gen.throw(type, value, traceback) File "/home/yangs/venv/hrlnav/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/response.py", line 307, in _error_catcher raise ReadTimeoutError(self._pool, None, &#39;Read timed out.&#39;) urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=&#39;files.pythonhosted.org&#39;, port=443): Read timed out. ---------------------------------------- ...Installing setuptools, pkg_resources, pip, wheel...done. Traceback (most recent call last): File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module> main() File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main symlink=options.symlink) File "/usr/lib/python3/dist-packages/virtualenv.py", line 992, in create_environment download=download, File "/usr/lib/python3/dist-packages/virtualenv.py", line 922, in install_wheel call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT) File "/usr/lib/python3/dist-packages/virtualenv.py", line 817, in call_subprocess % (cmd_desc, proc.returncode)) OSError: Command /home/yangs/venv/hrlnav/bin/python3.6 - setuptools pkg_resources pip wheel failed with error code 2 这是什么错误
最新发布
05-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值