Python2-Module können nicht installiert werden (Kali 2020)

Python2-Module können nicht installiert werden (Kali 2020)
$ pip install impacket                                                                                                                                                                                                                  
    Requirement already satisfied: impacket in /home/kali/.local/lib/python3.9/site-packages (0.9.16.dev0)

$ sudo python2 -m pip install impacket  
    /usr/bin/python2: No module named pip

Ich habe das gefunden:

$ curl https://bootstrap.pypa.io/get-pip.py -o pip2.py

$ sudo python2 pip2.py install impacket      
Collecting install  
Using cached install-1.3.0.tar.gz (1.8 kB)
    
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-JsNXwt/install/setup.py'"'"'; __file__='"'"'/tmp/pip-install-JsNXwt/install/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-zr9fqs
         cwd: /tmp/pip-install-JsNXwt/install/
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help
    
    error: invalid command 'egg_info'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Antwort1

Python2 ist veraltet. Hier erfahren Sie, wie Sie Python2 basierend auf den Kali-Dokumenten korrekt auf Kali Linux Rolling Release installieren:Verwenden von EoL-Python-Versionen auf Kali

Python 2 wird in den Debian-Repositories nicht mehr gepflegt. Das bedeutet, dass wir einen Weg finden müssen, dieses Problem zu umgehen. pyenv löst dieses Problem, indem es uns ermöglicht, mehrere Python-Versionen zu installieren, die nicht miteinander in Konflikt stehen.

Mit pyenv können Sie Python2 installieren:

sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git

curl https://pyenv.run |bash 
export PYENV_ROOT="$HOME/.pyenv
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then  eval "$(pyenv init -)" ; fi
exec $SHELL
pyenv
pyenv install 2.7.18
pyenv global 2.7.18
python2 -m pip install impacket

Führen Sie dann Python2 aus und überprüfen Sie die Impacket-Version:

python2
>>> from impacket import version
>>> version.BANNER

Beispielausgabe:

'Impacket v0.9.18 - Copyright 2018 SecureAuth Corporation\n'

Antwort2

Ich habe es herausgefunden $ curlhttps://bootstrap.pypa.io/get-pip.py-o get-pip.py

$ python get-pip.py

Jetzt funktioniert pip2 und wird in Python2-Verzeichnisse installiert

Ich muss vorher etwas vermasselt haben. Wie auch immer, jetzt können wir Module für Python2 installieren

verwandte Informationen