我的 Kali linux 显示“没有名为 importlib 的模块”“来自 importlib 导入 import_module”

原文标题My Kali linux showing ‘No module named importlib’ ‘from importlib import import_module’

尝试使用安装在 /usr/local/lib/python2.7/dist-packages 中的 pip 安装构建依赖项当我尝试安装时,会出现错误

Collecting git+https://github.com/kti/python-netfilterqueue (from -r requirements.txt (line 1))
  Cloning https://github.com/kti/python-netfilterqueue to /tmp/pip-req-build-VQbxfT
  Running command git clone -q https://github.com/kti/python-netfilterqueue /tmp/pip-req-build-VQbxfT
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python2 /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNlNAvr                            
       cwd: /tmp/pip-req-build-VQbxfT                                                                                                                                  
  Complete output (4 lines):                                                                                                                                           
  Traceback (most recent call last):                                                                                                                                   
    File "/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 16, in <module>                                                                    
      from importlib import import_module                                                                                                                              
  ImportError: No module named importlib                                                                                                                               
  ----------------------------------------                                                                                                                             
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNlNAvr Check the logs for full command output.

所以我尝试用pip安装importlib,我仍然得到同样的错误。然后我直接将它安装到/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/使用

pip install importlib --target=/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/

因为 pip 已将所有软件包安装到 /usr/local/lib/python2.7/dist-packages,但无论哪种方式我仍然收到错误

原文链接:https://stackoverflow.com//questions/71910057/my-kali-linux-showing-no-module-named-importlib-from-importlib-import-import

回复

我来回复
  • sudden_appearance的头像
    sudden_appearance 评论

    假设您正在尝试安装python-netfilterqueue

    您可以访问 github 页面并查看此内容

    当前版本的 NetfilterQueue 需要 Python 3.6 或更高版本。

    所以你不能为 python 2.7 安装这个库

    但是你可以安装0.9.0因为它还说

    支持 Python 2.7 的最后一个版本是 0.9.0。

    pip install NetfilterQueue=0.9.0
    
    2年前 0条评论