简体   繁体   English

我的 Kali linux 显示 'No module named importlib' 'from importlib import import_module'

[英]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.

相关问题 from django.utils.importlib import import_module ImportError: No module named importlib - from django.utils.importlib import import_module ImportError: No module named importlib ModuleNotFoundError:没有命名的模块<module>在 importlib 上 import_module</module> - ModuleNotFoundError: No module named <module> on importlib import_module 如何使用 python importlib 从相对路径动态 import_module - How to dynamically import_module from a relative path with python importlib Python importlib import_module相对导入模块 - Python importlib import_module Relative Import of Module Python:从 importlib 模块导入子模块 - Python: import submodule from importlib module Python,导入库。 模仿“from module import *” - Python, Importlib. Imitation of "from module import * " 文件“ /usr/lib/python2.7/importlib/__init__.py”,第37行,位于import_module __import __(name)ImportError中:没有名为django的模块 - File “/usr/lib/python2.7/importlib/__init__.py”, line 37, in import_module __import__(name) ImportError: No module named django importlib.import_module 不是 package - importlib.import_module is not a package importlib.import_module(m) 可以做`from m import *` 吗? - Can importlib.import_module(m) do `from m import *`? 使用importlib.import_module从m import v替换 - Usage of importlib.import_module to replace from m import v
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM