- 问题
- 解决办法
问题
Ubuntu下Anaconda3安装完成后测试conda -V报错: command not found,$ source ~/.bashrc报错-sh: 1: source: not found
解决办法$ echo 'export PATH="/home/users/zwc/anaconda3/bin:$PATH"' >> ~/.bashrc $ source ~/.bashrc 报错 -sh: 1: source: not found
原因:sh 和 bash 是不同的 shell,sh中没有 source 命令。所以用 sh 或者 ./ 运行的时候,会提示这个错误。
测试:
运行 ls -l /bin/sh 后显示/bin/sh -> dash
这说明是用dash来进行解析的。
$ ls -l /bin/sh lrwxrwxrwx 1 root root 4 6月 23 01:53 /bin/sh -> dash
解决方案:
命令行执行:dpkg-reconfigure dash(需要root权限)
在界面中选择no
再运行ls -l /bin/sh 后显示/bin/sh -> bash
这个 *** 作需要root权限,实验室公用服务器上不太方便改,可以使用exec bash来从dash切换到bash,就能正常使用source了
$ exec bash (base) zwc@ubuntu:~$ anaconda -V anaconda Command line client (version 1.7.2) (base) zwc@ubuntu:~$
显示安装成功
(base) zwc@ubuntu:~$ python Python 3.8.8 (default, Apr 13 2021, 19:58:26) [GCC 7.3.0] :: Anaconda, Inc. on linux
参考链接:ubuntu系统shell 中source: not found错误
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)