目录名的 Python 路径问题:未找到命令,未找到 conda 环境 python

目录名的 Python 路径问题:未找到命令,未找到 conda 环境 python

我正在运行 MacOS Catalina (10.15)。它现在给我带来了多个 bash 问题。它给了我以下两个错误。它们有关联吗?如果有关联,我该如何修复它们?

(base) dhcp-10-105-176-29:cpotts-swda adamg$ conda activate swda
-bash: dirname: command not found
-bash: dirname: command not found
(swda) dhcp-10-105-176-29:cpotts-swda adamg$ echo $PATH
/bin:/bin:/Users/adamg/anaconda3/envs/swda/bin:/bin:/Users/adamg/Library/Python/3.7/bin
(swda) dhcp-10-105-176-29:cpotts-swda adamg$ python
-bash: python: command not found

答案1

Bash 找不到命令(dirnamepython),因为您的$PATH变量未正确设置。

将这一行添加到您的末尾~/.bash_profile

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:$PATH

GNU bash 文档

PATH

A colon-separated list of directories in which the shell looks for commands. 

相关内容