不再能够通过pip安装python软件包“ ImportError:导入_socket时,DLL加载失败:%1不是有效的Win32应用程序”

时间:2020-11-08 19:49:29

标签: python python-3.x pip

使用Windows 10

这是一个新问题,我不确定是什么原因引起的。我以前一直成功使用pip。当我尝试安装pip时,我总是会收到此确切错误:

    Traceback (most recent call last):
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files (x86)\Python38-32\Scripts\pip.exe\__main__.py", line 5, in <module>
  File "c:\program files (x86)\python38-32\lib\site-packages\pip\_internal\cli\main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "c:\program files (x86)\python38-32\lib\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "c:\program files (x86)\python38-32\lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "c:\program files (x86)\python38-32\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
  File "c:\program files (x86)\python38-32\lib\site-packages\pip\_internal\cli\progress_bars.py", line 12, in <module>
    from pip._internal.utils.logging import get_indentation
  File "c:\program files (x86)\python38-32\lib\site-packages\pip\_internal\utils\logging.py", line 9, in <module>
    import logging.handlers
  File "c:\program files (x86)\python38-32\lib\logging\handlers.py", line 26, in <module>
    import logging, socket, os, pickle, struct, time, re
  File "c:\program files (x86)\python38-32\lib\socket.py", line 49, in <module>
    import _socket
ImportError: DLL load failed while importing _socket: %1 is not a valid Win32 application.

是什么导致此错误,我该如何解决?

1 个答案:

答案 0 :(得分:0)

[信誉不足,无法评论,但是]%PATH%环境变量中缺少目录。您需要将Python基本DLL位置添加到您的path变量中,但需要其他人来提供详细信息。

编辑:您可能在%PATH%变量中缺少cuda\bin子目录。 Google应该帮助您找出解决方法。