[英]My Kali linux showing 'No module named importlib' 'from importlib import import_module'
Trying to install build dependencies with pip which is installing in /usr/local/lib/python2.7/dist-packages As I try to install proceed gives an error尝试使用安装在 /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.
so I try to install importlib with pip and I still get the same error.所以我尝试用 pip 安装 importlib,但我仍然遇到同样的错误。 Then I install it directly to /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/ using
然后我将它直接安装到 /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/ 使用
pip install importlib --target=/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/
because pip has been installing all packages to /usr/local/lib/python2.7/dist-packages, but I still get the error either way因为 pip 已经将所有包安装到 /usr/local/lib/python2.7/dist-packages,但无论哪种方式我仍然得到错误
Assuming you are trying to install python.netfilterqueue
.假设您正在尝试安装
python.netfilterqueue
。
You can visit github page and see this你可以访问github页面看到这个
The current version of NetfilterQueue requires Python 3.6 or later.
当前版本的 NetfilterQueue 需要 Python 3.6 或更高版本。
So you can't install this lib for python 2.7所以你不能为 python 2.7 安装这个库
But you can install 0.9.0
as it also stated that但是您可以安装
0.9.0
,因为它还指出
The last version with support for Python 2.7 was 0.9.0.
支持 Python 2.7 的最新版本是 0.9.0。
pip install NetfilterQueue=0.9.0
Try switching to python3 because this will definitely work.尝试切换到 python3,因为这肯定会起作用。
First you have to install cython.首先你必须安装cython。
pip install cython
Then after that you need to make sure you install NetfilterQueue from source.然后,您需要确保从源代码安装 NetfilterQueue。
git clone https://github.com/oremanj/python-netfilterqueue
Navigate to the.netfilterqueue directory.导航到 .netfilterqueue 目录。
cd python-netfilterqueue
Then run this command.然后运行这个命令。
python3 setup.py install
That's it.就是这样。 It should work properly
它应该可以正常工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.