为什么在Kali Linux 22.4中pip不起作用。

huangapple go评论101阅读模式
英文:

why pip is not working in Kali linux. 22.4

问题

Pip在我的Kali Linux 22.4中不起作用。
Python3和pip都是最新版本已安装。安装证明
我在VMware上运行我的Kali Linux,kali也是最新的。
当我尝试通过"pip"安装numpy或其他任何东西时,出现了这个错误。这里是错误的图像

pip install PIL
错误:externally-managed-environment

× 这个环境是由外部管理的
╰─> 要系统范围内安装Python包,请尝试apt install
python3-xyz,其中xyz是您尝试安装的包名。

如果您希望安装一个非Debian打包的Python包,
使用python3 -m venv path/to/venv创建一个虚拟环境。
然后使用path/to/venv/bin/python和path/to/venv/bin/pip。确保已安装python3-full。

如果您希望安装一个非Debian打包的Python应用程序,
最简单的方式可能是使用pipx install xyz,它将为您管理一个虚拟环境。确保已安装pipx。

有关更多信息,请参阅/usr/share/doc/python3.11/README.venv。

注意:如果您认为这是一个错误,请联系Python安装或操作系统发行商。您可以通过传递--break-system-packages来覆盖此操作,但这可能会破坏您的Python安装或操作系统。提示:请参阅PEP 668以获取详细规范。

我试图使用pip安装Python库,但出现了这个错误。手动安装没有问题。

英文:

Pip is not working in my kali Linux 22.4.
Python3 and pip is the newest version installed. prove of install
I am running my Kali Linux on VMware. kali is also the letest one.
While I install nummpy or anything by "pip" its through this error. here is the image of error

pip install PIL
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

i was tring to install a library of python by pip but get this error. Manually i can install.

答案1

得分: -1

对我来说,以下方法有效:

sudo apt-get install python-pkg

其中"python-pkg"是您的Python包的名称。

您也可以尝试:

python3 -m pip install python-pkg

这在我的Mac上有效。

英文:

For me it worked by

> sudo apt-get install python-pkg

where "python-pkg" is the name your python package.

You can also try

> python3 -m pip install python-pkg

worked for me on a Mac.

huangapple
  • 本文由 发表于 2023年2月27日 15:05:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/75577561.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定