Closed murmurfish closed 6 months ago
打开你的终端命令行,逐一运行下面的几个命令,把每一个命令的输出结果贴上来:
Get-Command python
Get-Command python3
Get-Command pip
Get-Command pip3
python -V
python3 -V
pip -V
pip3 -V
PS C:\Users\HP> Get-Command python
CommandType Name Version Source
Application python.exe 3.11.41... C:\Users\HP\AppData\Local\Programs\Python\Python311\python.exe
PS C:\Users\HP> Get-Command python3
CommandType Name Version Source
Application python3.exe 0.0.0.0 C:\Users\HP\AppData\Local\Microsoft\WindowsApps\python3.exe
PS C:\Users\HP> Get-Command pip
CommandType Name Version Source
Application pip.exe 0.0.0.0 C:\Users\HP\AppData\Local\Programs\Python\Python311\Scripts\pip.exe
PS C:\Users\HP> Get-Command pip3
CommandType Name Version Source
Application pip3.exe 0.0.0.0 C:\Users\HP\AppData\Local\Programs\Python\Python311\Scripts\pip3.exe
PS C:\Users\HP> python -V Python 3.11.4 PS C:\Users\HP> python3 -V PS C:\Users\HP> pip -V pip 23.1.2 from C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11) PS C:\Users\HP> pip3 -V pip 23.1.2 from C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)
继续:
pip install termcolor
pip list
结果是啥?
每次要求我更新都会下载到0.3/2.1MB中断,以下为结果:
PS C:\Users\HP\Desktop\个人\code\wop> ### pip install termcolor Collecting termcolor Downloading termcolor-2.3.0-py3-none-any.whl (6.9 kB) ERROR: Exception: Traceback (most recent call last): File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\urllib3\response.py", line 438, in _error_catcher yield File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\urllib3\response.py", line 561, in read data = self._fp_read(amt) if not fp_closed else b"" ^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\urllib3\response.py", line 527, in _fp_read return self._fp.read(amt) if amt is not None else self._fp.read() ^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\cachecontrol\filewrapper.py", line 90, in read data = self.__fp.read(amt) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 466, in read s = self.fp.read(amt) ^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\socket.py", line 706, in readinto return self._sock.recv_into(b) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1278, in recv_into return self.read(nbytes, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1134, in read return self._sslobj.read(len, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TimeoutError: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\base_command.py", line 169, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\req_command.py", line 248, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\commands\install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\structs.py", line 156, in bool
return bool(self._sequence)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 155, in bool
return any(self)
^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 143, in
[notice] A new release of pip is available: 23.1.2 -> 23.2.1 [notice] To update, run: python.exe -m pip install --upgrade pip PS C:\Users\HP\Desktop\个人\code\wop> ### python.exe -m pip install --upgrade pip Requirement already satisfied: pip in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (23.1.2) Collecting pip Downloading pip-23.2.1-py3-none-any.whl (2.1 MB) ━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.1/2.1 MB 152.8 kB/s eta 0:00:14 ERROR: Exception: Traceback (most recent call last): File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\urllib3\response.py", line 438, in _error_catcher yield File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\urllib3\response.py", line 561, in read data = self._fp_read(amt) if not fp_closed else b"" ^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\urllib3\response.py", line 527, in _fp_read return self._fp.read(amt) if amt is not None else self._fp.read() ^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\cachecontrol\filewrapper.py", line 90, in read data = self.__fp.read(amt) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 466, in read s = self.fp.read(amt) ^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\socket.py", line 706, in readinto return self._sock.recv_into(b) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1278, in recv_into return self.read(nbytes, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1134, in read return self._sslobj.read(len, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TimeoutError: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\base_command.py", line 169, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\req_command.py", line 248, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\commands\install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\resolvelib\structs.py", line 156, in bool
return bool(self._sequence)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 155, in bool
return any(self)
^^^^^^^^^
File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 143, in
PS C:\Users\HP\Desktop\个人\code\wop> ### pip list Package Version
asttokens 2.4.0 backcall 0.2.0 colorama 0.4.6 comm 0.1.4 debugpy 1.8.0 decorator 5.1.1 executing 1.2.0 ipykernel 6.25.2 ipython 8.15.0 jedi 0.19.0 jupyter_client 8.3.1 jupyter_core 5.3.1 matplotlib-inline 0.1.6 nest-asyncio 1.5.8 packaging 23.1 parso 0.8.3 pickleshare 0.7.5 pip 23.1.2 platformdirs 3.10.0 prompt-toolkit 3.0.39 psutil 5.9.5 pure-eval 0.2.2 Pygments 2.16.1 python-dateutil 2.8.2 pywin32 306 pyzmq 25.1.1 setuptools 65.5.0 simpleeval 0.9.13 six 1.16.0 stack-data 0.6.2 tornado 6.3.3 traitlets 5.10.0 wcwidth 0.2.6
网络问题导致你安装 termcolor
这个包失败了,那么后续自然无法使用。
解决方案可以考虑换个国内的 PyPi 镜像,具体参见本站 Wiki 里的这个问答。
已通过国内的 PyPi 镜像解决,谢谢!