无法在 kali 上安装 python numpy

无法在 kali 上安装 python numpy

我正在尝试在我的 Linux VM 上安装 python-numpy(适用于 Python 2.7)。我遇到的问题是,当我运行

sudo apt-get install python-numpy

我明白了

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python-numpy

当我使用 .deb 安装它时,

sudo dpkg -i python-numpy_1.16.2-1_amd64.deb

我收到这个错误

Selecting previously unselected package python-numpy.
(Reading database ... 330820 files and directories currently installed.)
Preparing to unpack python-numpy_1.16.2-1_amd64.deb ...
Unpacking python-numpy (1:1.16.2-1) ...
dpkg: dependency problems prevent configuration of python-numpy:
 python-numpy depends on python (<< 2.8); however:
  Package python is not installed.
 python-numpy depends on python (>= 2.7~); however:
  Package python is not installed.
 python-numpy depends on python:any (<< 2.8).
 python-numpy depends on python:any (>= 2.7~).

dpkg: error processing package python-numpy (--install):
 dependency problems - leaving unconfigured
Processing triggers for kali-menu (2021.4.2) ...
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 python-numpy

但是我已经安装了python2.7并且python命令也指向python2.7

python    
Python 2.7.18 (default, Mar 28 2022, 20:47:09) 
[GCC 11.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

这里有人告诉我要安装 python2.7-dev,但我照做了,但没有用。

请帮帮我。

猫/etc/apt/sources.list

# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free

# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free

使用 Python2.7 因为 zenmap 依赖它并且我需要它。

答案1

我不确定这是否回答了你的问题,但要安装 python 模块,你应该使用pip install <module>。对于 numpy :

pip install numpy

sudo这不是必需的,否则 numpy 将以 root 身份安装。

另外,您使用 pytohn 2.7 而不是 python3 有什么真正原因吗?仅当兼容性不允许您使用较新版本时(例如在旧应用程序上工作时),才应使用 python2.7。要安装 python3 :

# Always make sure apt is up to date
sudo apt update

# install python3
sudo apt install python3

不要忘记先删除python2.7。希望这对你有帮助。

相关内容