侧边栏壁纸
博主头像
Kefei的记事本博主等级

好脑瓜不如烂笔头

  • 累计撰写 219 篇文章
  • 累计创建 11 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

python安装TTS出错

Administrator
2024-12-01 / 0 评论 / 0 点赞 / 2 阅读 / 2399 字

使用pip3安装软件包出现: The script normalizer is installed in '/home/user01/.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.

The script tabulate is installed in '/home/user01/.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.

The scripts edge-playback and edge-tts are installed in '/home/user01/.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 安装的脚本(如 normalizer、`tabulate`、`edge-playback` 和 edge-tts)被安装在了 /home/user01/.local/bin 这个目录下,而这个目录没有被添加到你的系统环境变量 PATH 中。因此,系统无法识别这些脚本,你需要将这个目录添加到 PATH 中,或者在安装时使用 --no-warn-script-location 选项来抑制这个警告。

以下是解决这个问题的步骤:

1. **添加目录到 PATH**:

- 打开你的 shell 配置文件,这可能是 .bashrc、`.bash_profile`、`.zshrc` 或 .profile,取决于你使用的 shell。可以使用文本编辑器打开,例如使用 nanovim

```

     nano ~/.bashrc

```

- 在文件末尾添加以下行(将 /home/user01/.local/bin 替换为实际的路径):

```

     export PATH=/home/user01/.local/bin:$PATH

```

- 保存并关闭文件。

- 使更改生效,可以通过运行以下命令:

```

     source ~/.bashrc

```

这样,你就将 /home/user01/.local/bin 目录添加到了 PATH 环境变量中,系统就能够识别安装在该目录下的脚本了。

2. **使用 --no-warn-script-location 选项**:

- 如果你不想修改 PATH,可以在安装包时使用 --no-warn-script-location 选项来抑制这个警告,例如:

```

     pip3 install package_name --no-warn-script-location

```

这将阻止 pip 显示脚本位置的警告,但不会改变脚本不可用的问题。

选择适合你情况的方法来解决这个问题。如果你经常需要使用这些脚本,添加目录到 PATH 是一个更彻底的解决方案。

0

评论区