【Python】WARNING: The script xx.exe is installed in xxdirectory which is not on PATH.

项目场景:使用pip安装jupyterlab时出现警告:

pip安装jupyterlab:pip install --user jupyterlab,出现警告:which is not on PATH

WARNING: The script jsonschema.exe is installed in 'C:\Users\huipu\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

原因分析:

警告的含义是:

脚本jsonschema.exe安装在’C: Users\huipu\AppData\Roaming\Python\Python39\Scripts’中,但是不在PATH中。
考虑将此目录添加到PATH中,或者,如果您希望废止此警告,可以使用 --no-warn-script-location


解决方案:

所以我们需要将该路径(‘C: Users\huipu\AppData\Roaming\Python\Python39\Scripts’)加入环境变量:

  1. 首先进入“设置”中的“高级系统设置”:

在这里插入图片描述

  1. 在“高级”一栏右下点击“环境变量”:

在这里插入图片描述

  1. 在“系统变量”中找到“Path”,选中之后点击下方的“编辑”:

在这里插入图片描述

  1. 点击右侧的“新建”,将警告信息中建议加入PATH的路径 'C:Users\huipu\AppData\Roaming\Python\Python39\Scripts’加进去:
    在这里插入图片描述
  2. 加完之后! 点击下方的“确定”,返回到上一级之后也要点“确定”,一直“确定”直到退出“高级系统设置”。

效果:

关掉之前的命令行,重新cmd启动一个新的界面,再运行命令pip install --user jupyterlab,发现警告消失:

在这里插入图片描述
为什么要重新启动cmd?
因为原cmd用的还是旧的环境变量,重新启动cmd使得我们更新后的环境变量起作用。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值