下载 python-certifi-win32 后 pip 崩溃

Asa*_*ary 9 python pip

我在新电脑上第一次下载了 python(版本 3.10.4)。python-certifi-win32在有人在与我遇到的问题类似的问题中建议将其作为 SSL 证书问题的解决方案后,我已经下载了该软件包。从那时起,pip就完全停止工作了,以至于我无法运行pip --version 每次打印相同的错误时,它大多看起来都是垃圾(只是一个深层堆栈跟踪),但最后的文件是不同的。

打印日志的开始:

Traceback (most recent call last):
  File "C:\Users\---\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 89, in _tempfile
    os.write(fd, reader())
  File "C:\Users\---\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
    with self.open('rb') as strm:
  File "C:\Users\---\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
    raise ValueError()
ValueError

During handling of the above exception, another exception occurred:
Run Code Online (Sandbox Code Playgroud)

打印日志的最后一行:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\-----\\AppData\\Local\\Temp\\tmpunox3fhw'
Run Code Online (Sandbox Code Playgroud)

Asa*_*ary 10

我在另一个问题中找到了答案 - PermissionError: [WinError 32] The process Cannot access the file because it is being used by another process: after Installation python-certifi-win32

基本上,您应该删除运行 pip 时初始化的两个文件python-certifi-win32。这些文件位于目录中:

C:\Users\<username>\AppData\Local\Programs\Python\Python310\Lib\site-packages
Run Code Online (Sandbox Code Playgroud)

他们的名字是:

python-certifi-win32-init.pth
distutils-precedence.pth
Run Code Online (Sandbox Code Playgroud)

从上述帖子中向理查德致敬:)