WARNING: The scripts … are installed in /home/…/.local/bin which is not on PATH. 警告之解决

        pip/pip3 安装或升级 Python 包(第三方库)时,有时会出现下述警告( … 为相应 script 及用户名等内容):

WARNING: The scripts ... are installed in '/home/.../.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.

        大意是没有将环境变量添加到路径,如果忽略这个警告,后续可能会出现无法导入包等情形……

        碰到这种情况建议先行卸载刚才进行的安装:

pip3 uninstall <package>

        查看数据盘根目录下隐藏文件是 .bashrc 还是 .zshrc ,然后在终端中相应输入

echo 'export PATH=/home/.../bin:$PATH' >>~/.bashrc
source ~/.bashrc

        /home/…/bin 为警告中提示的相应路径,予以替换即可。

        当然也可以文本编辑器打开上述路径文件,在末尾加入:export PATH=/home/…/bin:$PATH,保存后再在终端中运行 source ~/.bashrc

        至此即一劳永逸解决了上述警告,接下来尽管放心大胆地安装第三方库吧☺


关于第三方库的安装,请参见:

Python 第三方库之安装,升级,卸载,国内镜像及其他python包的本质就是模块https://blog.csdn.net/iprobobo/article/details/122806955

来源:香饽々

物联沃分享整理
物联沃-IOTWORD物联网 » WARNING: The scripts … are installed in /home/…/.local/bin which is not on PATH. 警告之解决

发表评论