如何抑制过期pip警告

2024-03-28 22:31:28 发布

您现在位置:Python中文网/ 问答频道 /正文

每个pip命令都以警告结束:

You are using pip version 18.1, however version 19.3.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

但是,更新pip不起作用,请参见下文。我可以取消警告吗?如何取消?我可以更新pip吗?如何更新?你知道吗

enter image description here

C:\WINDOWS\system32>python -m pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB) 100% |████████████████████████████████| 1.4MB 7.3MB/s Installing collected packages: pip Found existing installation: pip 18.1 Uninstalling pip-18.1: Successfully uninstalled pip-18.1 Rolling back uninstall of pip Exception: Traceback (most recent call last): File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_internal\cli\base_command.py", line 143, in main status = self.run(options, args) File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_internal\commands\install.py", line 366, in run use_user_site=options.use_user_site, File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_internal\req__init__.py", line 49, in install_given_reqs **kwargs File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_internal\req\req_install.py", line 760, in install use_user_site=use_user_site, pycompile=pycompile, File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_internal\req\req_install.py", line 382, in move_wheel_files warn_script_location=warn_script_location, File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_internal\wheel.py", line 441, in move_wheel_files generated.extend(maker.make(spec)) File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 403, in make self._make_script(entry, filenames, options=options) File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 307, in _make_script self._write_script(scriptnames, shebang, script, filenames, ext) File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 243, in _write_script launcher = self._get_launcher('t') File "C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 382, in _get_launcher result = finder(distlib_package).find(name).bytes AttributeError: 'NoneType' object has no attribute 'bytes' You are using pip version 18.1, however version 19.3.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\WINDOWS\system32>pip --version pip 18.1 from C:\Users\Dzenan\AppData\Roaming\Python\Python37\site-packages\pip (python 3.7)


Tags: installpipinpypackageslinescriptsite
1条回答
网友
1楼 · 发布于 2024-03-28 22:31:28

要在Windows上升级pip,您可以在this thread中找到答案。这似乎是解决办法:

python -m pip install -U  force-reinstall pip

或者,为了回答您关于抑制pip警告的实际问题,pip有-q/-qq/-qqq选项来抑制日志输出。你知道吗

相关问题 更多 >