问题描述
站长在对一台使用Debian 10系统的VPS执行流媒体解锁检测一键脚本时,发现报错信息如下:
/dev/fd/63: line 30: warning: setlocale: LC_ALL: cannot change locale (en_US)
就是这个脚本: 一键脚本 Netflix/Youtube/HBO/Disney+/Bilibili(港澳台)等流媒体解锁检测
如图所示:
![[已解决]warning: setlocale: LC_ALL: cannot change locale (en_US) [已解决]warning: setlocale: LC_ALL: cannot change locale (en_US)](https://img.hostcsr.com/images/2021061001.jpg)
原因分析
该VPS的Debian 10系统属于最小化版本,locale中没有配置en_US区域;执行命令locale -a查看当前已配置区域。
如下图所示:
![[已解决]warning: setlocale: LC_ALL: cannot change locale (en_US) [已解决]warning: setlocale: LC_ALL: cannot change locale (en_US)](https://img.hostcsr.com/images/2021061002.jpg)
解决办法
1、执行下方命令清除apt缓存&更新软件源&安装locales软件包。
apt-get clean && apt-get update && apt-get install -y locales
2、执行下方命令配置locales软件包,按住键盘↓把光标往下翻,一直到en_US ISO-8859-1这一行,按一下空格键光标指示处会出现一个*号,这就代表选中了;按TAB键将光标移动到Ok按钮上,回车。
dpkg-reconfigure locales
![[已解决]warning: setlocale: LC_ALL: cannot change locale (en_US) [已解决]warning: setlocale: LC_ALL: cannot change locale (en_US)](https://img.hostcsr.com/images/2021061003.jpg)
3、这个时候在Configuring locales(配置区域)下方就看到en_US了,要注意的是,只需要有en_US就行了,并不需要将默认设置改成en_US;按键盘↓箭头将光标移动到en_US.UTF-8上,然后按TAB键将光标移动到Ok按钮上,回车。
![[已解决]warning: setlocale: LC_ALL: cannot change locale (en_US) [已解决]warning: setlocale: LC_ALL: cannot change locale (en_US)](https://img.hostcsr.com/images/2021061004.jpg)
4、再次执行locale -a命令查看已经配置的区域。
![[已解决]warning: setlocale: LC_ALL: cannot change locale (en_US) [已解决]warning: setlocale: LC_ALL: cannot change locale (en_US)](https://img.hostcsr.com/images/2021061005.jpg)
5、再次执行该流媒体解锁查询一键脚本,没有报错信息了。
![[已解决]warning: setlocale: LC_ALL: cannot change locale (en_US) [已解决]warning: setlocale: LC_ALL: cannot change locale (en_US)](https://img.hostcsr.com/images/2021061006.jpg)
