我的 Kali linux 显示 'No module named importlib' 'from importlib import 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/ using
pip install importlib --target=/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/
因为pip一直在安装所有包到/usr/local/lib/python2.7/dist-packages,
但无论如何我仍然得到错误
假设您正在尝试安装 python-netfilterqueue
。
您可以访问 github 页面并查看此内容
The current version of NetfilterQueue requires Python 3.6 or later.
所以你不能为 python 2.7
安装这个库
但是你可以安装 0.9.0
因为它还说
The last version with support for Python 2.7 was 0.9.0.
pip install NetfilterQueue=0.9.0
尝试切换到 python3,因为这肯定有效。
首先你必须安装cython。
pip install cython
然后您需要确保从源代码安装 NetfilterQueue。
git clone https://github.com/oremanj/python-netfilterqueue
导航到 netfilterqueue 目录。
cd python-netfilterqueue
然后运行这个命令。
python3 setup.py install
就是这样。它应该可以正常工作
尝试使用安装在 /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/ using
pip install importlib --target=/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/
因为pip一直在安装所有包到/usr/local/lib/python2.7/dist-packages, 但无论如何我仍然得到错误
假设您正在尝试安装 python-netfilterqueue
。
您可以访问 github 页面并查看此内容
The current version of NetfilterQueue requires Python 3.6 or later.
所以你不能为 python 2.7
安装这个库但是你可以安装 0.9.0
因为它还说
The last version with support for Python 2.7 was 0.9.0.
pip install NetfilterQueue=0.9.0
尝试切换到 python3,因为这肯定有效。
首先你必须安装cython。
pip install cython
然后您需要确保从源代码安装 NetfilterQueue。
git clone https://github.com/oremanj/python-netfilterqueue
导航到 netfilterqueue 目录。
cd python-netfilterqueue
然后运行这个命令。
python3 setup.py install
就是这样。它应该可以正常工作