我的 Kali linux 显示“没有名为 importlib 的模块”“来自 importlib 导入 import_module”
python 460
原文标题 :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,但无论哪种方式我仍然收到错误