当我尝试在python上安装模块时,错误不断出现

时间:2020-09-21 13:33:51

标签: python pip

我正在尝试安装shodan和请求模块,但此错误不断出现,我不知道为什么。对于我的PC来说,它工作正常,但是当我在笔记本电脑上尝试该错误时,该错误不断出现。

我去了python的脚本总监,并输入了以下命令:

python -m pip install shodan

python -m pip install requests

但是,此错误不断出现:

Traceback (most recent call last):
  File "C:\Users\TPBYOD\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\TPBYOD\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\TPBYOD\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pip\__main__.py", line 16, in <module>
    from pip._internal import main as _main  # isort:skip # noqa
  File "C:\Users\TPBYOD\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "C:\Users\TPBYOD\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 8, in <module>
    from .connectionpool import (
  File "C:\Users\TPBYOD\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 7, in <module>
    from socket import error as SocketError, timeout as SocketTimeout
  File "C:\Users\TPBYOD\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 49, in <module>
    import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.

3 个答案:

答案 0 :(得分:1)

我已经解决了这个问题。谢谢。我要做的就是重新安装python,并确保将python添加到当前用户的变量和系统变量中

答案 1 :(得分:0)

这可能是因为您的操作系统是32位,而您使用的python版本是64位。尝试安装32位版本的python并安装这些库。

答案 2 :(得分:0)

尝试直接运行pip软件包管理器:

pip install shodan