在Linux中,您可以在哪里找到pip并将其添加到我的路径中?Python3.11.3

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

Where can i find pip in linux to add it to my path? Python3.11.3

问题

我已经在我的Linux机器上安装了Python 3.11.3,但每次我需要安装离线包或执行pip相关操作时,我必须使用以下命令运行:

python3.11 -m pip install "package"

但我无法只使用pip命令(而不带python3.11),像这样:

pip install "package"

我已经尝试将其添加到我的PATH,但我只在usr/local/bin/(我PATH中的文件夹)中找到一个非文件夹类型的文件,它是python3.11.3的文件,我漏掉了什么吗?pip文件位于何处,以便将其添加到我的PATH?

非常感谢。

编辑:

当我尝试运行pip install something时,它告诉我:

bash: pip: command not found...

我正在使用RHEL8,并且已经创建了一个别名来将其链接到我的python3.11版本。

如果我尝试which pip,它会给我No pip in (/usr/local/bin: .... etc

由于这台Linux机器没有互联网访问,因此我必须在离线状态下执行所有操作。

英文:

I've installed Python 3.11.3 in my Linux machine, but every time I need to install an offline package or do something with pip I have to run it using:

> python3.11 -m pip install "package"

But I can't use it just with the command pip (without python3.11) like:

> pip install "package"

I've searched for it to add to my PATH but I only find in usr/local/bin/ (the folder I have in my PATH) a not folder type file that is the one of python3.11.3, am I missing something, where is the pip file located to add it to my PATH?

Thank you very much.

Edit:

When I try to run pip install something it tells me:

bash: pip: command not found...

Im using RHEL8, and I've created an alias for python to link it to my python3.11 version.

If I try which pip it gives me No pip in (/usr/local/bin: .... etc

From this Linux machine I don't have internet access, so I have to do everything offline.

答案1

得分: 2

Add this line in ~/.bashrc:

alias pip='python3 -m pip'
英文:

Just add this line in ~/.bashrc

alias pip='python3 -m pip'

答案2

得分: 0

只使用这些命令:

sudo yum update
sudo yum -y install python3-pip

如果您使用 dnf 作为软件包管理器,也可以使用它。

英文:

Just utilize these commands

sudo yum update
sudo yum -y install python3-pip

You can also you dnf if that's what you use for package management.

答案3

得分: 0

我自己也遇到了类似的问题,您需要找到pip可执行文件,而不仅仅是文件夹本身,然后将其添加到“~/.bashrc”文件中。

在保存更改后,关闭终端并重新打开它。
之后,您应该能够在没有Python3前缀的情况下使用Pip。

英文:

Had a similar issue myself, you need to locate your pip executable and not just the folder itself and add it to the "~/.bashrc" file.

After you save the changes close the terminal and open it again.
You should be able to use Pip after that with no Python3 prefix

huangapple
  • 本文由 发表于 2023年5月29日 15:45:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76355510.html
匿名

发表评论

匿名网友

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

确定