Edw*_*ard 31 python centos pip path centos7
运行时,pip3.8
我的终端中出现以下警告
WARNING: The script pip3.8 is installed in '/usr/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.
Successfully installed pip-21.1.1 setuptools-56.0.0
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
Run Code Online (Sandbox Code Playgroud)
在centos 7上如何解决这个问题?
Mat*_*our 54
这个问题已在 serverfaults 论坛上得到解答:这是问题的链接。
您需要将以下行添加到您的~/.bash_profile
或~/.bashrc
文件中。
export PATH="/usr/local/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
然后,您需要进行分析,通过运行以下命令来执行此操作:
source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
或者只需关闭终端并打开一个新会话即可。您应该继续检查PATH
以确保它包含该路径。
echo $PATH
Run Code Online (Sandbox Code Playgroud)
J. *_*ner 19
其他答案也可以,但我找到了一种更惯用的方法,可以在 AWS 全新安装的 Ubuntu 20.04 上执行此操作。
该路径声明已经存在,但在 .profile 中
您需要注销,然后重新登录。获取环境无法做到这一点。
原因:
在.profile中,代码:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
Run Code Online (Sandbox Code Playgroud)
当您登录时,将执行并自动将 .local/bin 添加到您的路径中。
如果您通过sudo apt install python3-pip
刚刚创建的目录安装 pip3,并且您尚未注销 - 因此该路径语句尚未执行。
您还可以在执行 .profile 之后执行 .profile sudo apt install
。
归档时间: |
|
查看次数: |
110938 次 |
最近记录: |