В вашей системе Kali Linux полно устаревших пакетов Python. Вы можете убедиться в этом сами, для вывода пакетов Python 3, для которых выпущена новая версия:
pip3 list -o
Для вывода пакетов Python 2, для которых выпущена новая версия:
pip2 list -o
Чтобы обновить сразу все пакеты Python 3 в Kali Linux выполните команду:
for i in $(pip3 list -o | awk 'NR > 2 {print $1}'); do sudo pip3 install -U $i; done
Чтобы обновить сразу все пакеты Python 2 в Kali Linux выполните команду:
for i in $(pip2 list -o | awk 'NR > 3 {print $1}'); do sudo pip2 install -U $i; done
Ошибки pip при обновлении пакетов Python 3
Но если говорить точнее, то обновится большинство пакетов — некоторые не обновятся из-за разных ошибок и предупреждений.
Пример предупреждения, когда отсутствует необходимая зависимость:
python-debianbts 2.7.3 requires pysimplesoap!=1.16.2, which is not installed.
То есть пакету python-debianbts требуется pysimplesoap, который не установлен. Решение проблемы — просто устанавливаем отсутствующую зависимость командой вида:
sudo pip3 install имя_пакета
Например
sudo pip3 install pysimplesoap
Если проблема с пакетом для Python 2, то используем соответствующую версию pip:
sudo pip2 install имя_пакета
Когда установите все зависимости, ещё раз запустите команду из первого сообщения для повторной установки пакетов, которые не смогли обновиться.
Пример другого предупреждения, в котором упоминается distutils:
Cannot uninstall 'AdvancedHTTPServer'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
В сообщении сказано, что не получается удалить AdvancedHTTPServer, поскольку он является частью установленного distutils и невозможно точно определить, какие файлы принадлежат ему.
Можно просто пропустить обновления этих пакетов — то есть ничего не делать.
При желании обновить и эти пакеты, то используйте опцию --ignore-installed в команде вида:
sudo pip3 install имя_пакета --ignore-installed
Например, для обновления AdvancedHTTPServer:
sudo pip3 install AdvancedHTTPServer -U --ignore-installed
Если пакет предназначен для Python2, то используйте pip2:
sudo pip2 install имя_пакета --ignore-installed
Также у меня возникло несколько других ошибок, в основном при сборке пакетов из-за отсутствия необходимых файлов. Причина чаще всего в том, что не установлена необходимая зависимость (разные заголовки для компиляции). Такие ошибки нужно решать в индивидуальном порядке — смотреть, какого файла не хватает, искать какому пакету он принадлежит, устанавливать этот пакет и заново запускать обновление.
Например:
…………………. copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo running build_ext 'pkg-config' not found. Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1'] ---------------------------------------- Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-cyohyrgs/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-y_v2ezqy/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-cyohyrgs/pycairo/
Говорит о том, что pkg-config не найден, устанавливаем его:
sudo apt install -y pkg-config
Сообщение:
creating build creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="1.9.74" -I/usr/include/python3.6m -c cupsmodule.c -o build/temp.linux-x86_64-3.6/cupsmodule.o cupsmodule.c:23:10: fatal error: cups/cups.h: Нет такого файла или каталога #include <cups/cups.h> ^~~~~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for pycups
Говорит о том, что отсутствует файл cups/cups.h, этот файл имеется в пакете libcups2-dev, устанавливаем его:
sudo apt install libcups2-dev
Ошибка:
copying smbc/__init__.py -> build/lib.linux-x86_64-3.6/smbc running build_ext building '_smbc' extension creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/smbc x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c smbc/smbcmodule.c -o build/temp.linux-x86_64-3.6/smbc/smbcmodule.o In file included from smbc/smbcmodule.c:30: smbc/smbcmodule.h:27:10: fatal error: libsmbclient.h: Нет такого файла или каталога #include ^~~~~~~~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for pysmbc
Нужно установить пакет libsmbclient-dev, который содержит требуемый файл libsmbclient.h.
sudo apt install libsmbclient-dev
Сообщение об ошибке:
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-og2c2qf9/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-yttz5smu --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 creating build/lib.linux-x86_64-3.6/cairo copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo running build_ext Package cairo was not found in the pkg-config search path. Perhaps you should add the directory containing `cairo.pc' to the PKG_CONFIG_PATH environment variable No package 'cairo' found Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1.
Для решения проблемы установите пакеты:
sudo apt install libcairo2-dev libjpeg-dev libgif-dev
Ошибка:
…………………….. Complete output from command python setup.py egg_info: /bin/sh: 1: mysql_config: not found Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-_a5c_n1z/mysqlclient/setup.py", line 16, in metadata, options = get_config() File "/tmp/pip-install-_a5c_n1z/mysqlclient/setup_posix.py", line 53, in get_config libs = mysql_config("libs_r") File "/tmp/pip-install-_a5c_n1z/mysqlclient/setup_posix.py", line 28, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) OSError: mysql_config not found
Для её разрешения:
sudo apt install libmariadbclient-dev
Ошибки pip при обновлении пакетов Python 2
Ошибка:
Complete output from command python setup.py egg_info: sh: 1: mysql_config: not found Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-A1nxJy/mysqlclient/setup.py", line 16, in metadata, options = get_config() File "setup_posix.py", line 53, in get_config libs = mysql_config("libs_r") File "setup_posix.py", line 28, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-A1nxJy/mysqlclient/
Для её решения установите default-libmysqlclient-dev:
sudo apt install default-libmysqlclient-dev
Ошибка:
………………………………... building 'pcapy' extension creating build creating build/temp.linux-x86_64-2.7 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-AjKZhf/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c pcapdumper.cc -o build/temp.linux-x86_64-2.7/pcapdumper.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ pcapdumper.cc:11:10: fatal error: pcap.h: Нет такого файла или каталога #include ^~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for pcapy
Её причина в том, что не найден файл pcap.h, данный файл содержится в пакете libpcap-dev. И для решения этой проблемы нужно установить этот пакет.
sudo apt install libpcap-dev
Ошибка:
……………………. Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-fNcabS/pycurl/setup.py", line 913, in ext = get_extension(sys.argv, split_extension_source=split_extension_source) File "/tmp/pip-install-fNcabS/pycurl/setup.py", line 582, in get_extension ext_config = ExtensionConfiguration(argv) File "/tmp/pip-install-fNcabS/pycurl/setup.py", line 99, in __init__ self.configure() File "/tmp/pip-install-fNcabS/pycurl/setup.py", line 227, in configure_unix raise ConfigurationError(msg) __main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-fNcabS/pycurl/
Для её решения установите пакеты:
sudo apt install libcurl4-openssl-dev libssl-dev
Ошибка:
……………………………….. configure.ac:47: error: possibly undefined macro: AC_PROG_LIBTOOL If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. autoreconf: /usr/bin/autoconf failed with exit status: 1 Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-8JniC2/pylibemu/setup.py", line 244, in libraries = ["emu"] File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands()
Для её исправления:
sudo apt install libtool
Ошибка:
building 'pysqlite2._sqlite' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/src x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-AjKZhf/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -IPackage -Isqlite3 -Iwas -Inot -Ifound -Iin -Ithe -Ipkg-config -Isearch -Ipath. -IPerhaps -Iyou -Ishould -Iadd -Ithe -Idirectory -Icontaining -I`sqlite3.pc' -Ito -Ithe -IPKG_CONFIG_PATH -Ienvironment -Ivariable -INo -Ipackage -I'sqlite3' -Ifound -I/usr/include/python2.7 -c src/module.c -o build/temp.linux-x86_64-2.7/src/module.o In file included from src/module.c:24: src/connection.h:33:10: fatal error: sqlite3.h: Нет такого файла или каталога #include "sqlite3.h" ^~~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ----------------------------------------
Для её исправления установите пакет:
sudo apt install libsqlite3-dev
Ошибка:
………………
checking for GTK+ - version >= 3.0.0... Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
no
Could not run GTK+ test program, checking why...
The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GTK+ is incorrectly installed.
configure: error:
The development files for GTK+ were not found. For GTK+ 2, please
ensure that pkg-config is in the path and that gtk+-2.0.pc is
installed. For GTK+ 1.2 please check that gtk-config is in the path,
and that the version is 1.2.3 or above. Also check that the
libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
--libs' are in the LD_LIBRARY_PATH or equivalent.
Error running configure
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "build.py", line 1321, in cmd_build_wx
wxbuild.main(wxDir(), build_options)
File "/tmp/pip-install-_LJgZR/wxPython/buildtools/build_wxwidgets.py", line 375, in main
"Error running configure")
File "/tmp/pip-install-_LJgZR/wxPython/buildtools/build_wxwidgets.py", line 85, in exitIfError
raise builder.BuildError(msg)
BuildError
Finished command: build_wx (3.554s)
Finished command: build (3.554s)
Command '"/usr/bin/python" -u build.py build' failed with exit code 1.
Для её исправления установите следующие пакеты:
sudo apt install build-essential libgtk-3-dev
Сообщение «You are using pip version ..., however version ... is available.»
Если при использовании pip3 и pip2 возникают сообщения вида:
You are using pip version ..., however version ... is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
То значит нужно обновить саму версию pip.
Для обновления pip3:
pip3 install --upgrade pip
Для обновления pip2
pip2 install --upgrade pip