如何在 Linux 上将 pip 安装到 PATH?

问题描述 投票:0回答:1

我通过pip安装了

PyInstaller
,但是当我尝试运行它时,我得到了
pyinstaller: command not found

安装包后显示以下警告:

WARNING: The scripts pyi-archive_viewer, pyi-bindepend, pyi-grab_version, pyi-makespec, pyi-set_version and pyinstaller are installed in '/home/kevinapetrei/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

你知道我该怎么做吗

pip
将所有东西直接安装到
PATH

python linux pip
1个回答
22
投票

与其弄乱

PATH
中现有的整体,不如考虑将pip中的位置附加到它。

通常是

~/.local/bin
(与systemd的文件层次结构一致)。

添加/修改环境变量的好地方是

~/.profile
文件。
您可以通过添加以下行来完成:

export PATH="$HOME/.local/bin:$PATH"

您也可以考虑

~/.pam_environment
(但语法略有不同)。


对于那些想知道问题实际答案的人:
它曾经在旧版本的 Python 3 中有点可能,但这个选项被修补了。

© www.soinside.com 2019 - 2024. All rights reserved.