0

每当我尝试安装 pip 时,我总是会收到此错误。请帮忙。我不知道如何解决这个问题,我尝试使用默认的 python 可执行文件使用 modify 方法进行此操作,还尝试了 get-pip.py 文件方法,但没有任何效果。我也检查了我的路径变量,所以脚本文件夹在那里,但没有安装 pip。

    PS C:\Users\ismai\Desktop\programs\PYTHON> python get-pip.py
Traceback (most recent call last):
  File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 23704, in <module>
    main()
  File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 198, in main
    bootstrap(tmpdir=tmpdir)
  File "C:\Users\ismai\Desktop\programs\PYTHON\get-pip.py", line 83, in bootstrap
    from pip._internal.commands.install import InstallCommand
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\commands\install.py", line 17, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\cli\req_command.py", line 16, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_internal\index\collector.py", line 14, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\__init__.py", line 125, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\utils.py", line 27, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\ismai\AppData\Local\Temp\tmpz82tcza4\pip.zip\pip\_vendor\requests\compat.py", line 65, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 786, in exec_module
  File "<frozen importlib._bootstrap_external>", line 922, in get_code
  File "<frozen importlib._bootstrap_external>", line 980, in get_data
OSError: [Errno 9] Bad file descriptor
4

3 回答 3

0

好吧,伙计们,我尝试卸载这个新版本(3.9),然后安装旧版本(3.7),然后运行命令python get-pip.py,神奇地它工作了。如果将来有人想解决此问题,请尝试此操作。我还阅读了 python 文档,如果你的 python 版本上没有安装 pip,他们显然有一个命令,python -m ensurepip所以你也可以尝试。

于 2020-10-30T13:37:21.157 回答
0

我实际上遇到了类似的问题并尝试了所有可能的解决方案,唯一对我有用的是卸载 python 并将其重新安装在 C 以外的不同分区中,它会起作用!

于 2021-08-08T15:49:00.090 回答
0

卸载 python 然后从https://www.python.org/downloads/下载它并重新安装它并确保选中将 pip 添加到 PATH 的框。

于 2020-10-30T05:46:56.100 回答