[xxxx@gs-server-7214 ~]$ /opt/anaconda3/bin/jupyter notebook
-bash: /opt/anaconda3/bin/jupyter: /opt/anaconda3/bin/python: 坏的解释器: 没有那个文件或目录
[xxxx@gs-server-7214 ~]$ /opt/anaconda3/bin/python3
Python 3.6.10 |Anaconda, Inc.| (default, May 8 2020, 02:54:21)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[1]+ 已停止 /opt/anaconda3/bin/python3
- 创建软连接
已经通过/opt/anaconda3/bin/python3 -m pip install jupyter
安装了jupyter,全路径下也可以启动python,但是全路径下启动jupyter报错如上,原因是anaconda默认解释器路径为/opt/anaconda3/bin/python,实际没有该文件,创建软连接python指向实际存在的解释器python3.6, 如下->
表示软连接
[xxxx@gs-server-7214 bin]$ ll |grep python
-rwxrwxr-x 1 root root 237 10月 24 2019 ipython
-rwxrwxr-x 1 root root 237 10月 24 2019 ipython3
lrwxrwxrwx 1 root root 9 7月 16 16:31 python -> python3.6
lrwxrwxrwx 1 root root 9 8月 28 2020 python3 -> python3.6
-rwxrwxr-x 1 root root 11947112 5月 8 2020 python3.6
lrwxrwxrwx 1 root root 17 8月 28 2020 python3.6-config -> python3.6m-config
lrwxrwxrwx 1 root root 9 8月 28 2020 python3.6m -> python3.6
-rwxrwxr-x 1 root root 3477 8月 28 2020 python3.6m-config
lrwxrwxrwx 1 root root 17 8月 28 2020 python3-config -> python3.6m-config
2.设置环境变量
修改自己用户目录下的.bash_profile
文件,添加环境变量,export PATH=/opt/anaconda3/bin:$PATH
,冒号是分隔符。source .bash_profile
使环境变量生效,这样在自己用户目录下直接输入jupyter notebook
就可以启动jupyter了。