模块已安装,但 Python 程序仍提示我安装

模块已安装,但 Python 程序仍提示我安装
nandos@joseph:~$ pip3 install colorama pysnmp
Requirement already satisfied: colorama in ./.local/lib/python3.7/site-packages (0.4.1)
Requirement already satisfied: pysnmp in ./.local/lib/python3.7/site-packages (4.4.11)
Requirement already satisfied: pycryptodomex in ./.local/lib/python3.7/site-packages (from pysnmp) (3.8.2)
Requirement already satisfied: pyasn1>=0.2.3 in ./.local/lib/python3.7/site-packages (from pysnmp) (0.4.6)
Requirement already satisfied: pysmi in ./.local/lib/python3.7/site-packages (from pysnmp) (0.3.4)
Requirement already satisfied: ply in ./.local/lib/python3.7/site-packages (from pysmi->pysnmp) (3.11)
nandos@joseph:~$ pip3 install win_unicode_console
Requirement already satisfied: win_unicode_console in ./.local/lib/python3.7/site-packages (0.5)
nandos@joseph:~$ '/home/nandos/Downloads/PRET-master/pret.py' 
Please install the 'colorama' module for color support.
Please install the 'pysnmp' module for SNMP support.

usage: pret.py [-h] [-s] [-q] [-d] [-i file] [-o file] target {ps,pjl,pcl}
pret.py: error: too few arguments

答案1

你的 Python 应用程序上的输出head -n 1表明它是一个 Python 2 应用程序。

您已安装指定库的 Python 3 版本,但未安装 Python 2 版本。Python 2 和 Python 3 解释器不同的并且您需要确保为正确的解释器安装了正确的库。

pip如果尚未安装,请安装 Python 2 及其对应版本,然后安装您需要的相应 Python 模块:

sudo apt install python-all python-pip
pip install colorama pysnmp

然后运行您的应用程序。如果运行正常,只要您实际为程序提供了适当的参数,它现在就应该“正常工作”,就像它在错误消息的最后一行中指示的那样。

相关内容