热线电话:13121318867

登录
2020-07-20 阅读量: 5369
Jupyter notebook报“Jupyter”不是内部命令也不是外部命令的错误

【环境】win10


【解决】首先要安装python3,其次按以下步骤排查:


1,没有安装jupyter notebook,安装它:


python3 -m pip install --upgrade pip
python3 -m pip install jupyter

2,安装了jupyter notebook,但是没有添加到系统path,添加一下:


控制面板-系统和安全-系统-高级系统设置-环境变量-在用户变量和系统变量的path中都添加以下内容:

C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages

3,安装了jupyter也添加了path,但是命令输入不对。打开cmd,输入jupyter.py而不是jupyter,不再报错:


C:\WINDOWS\system32>jupyter.py -h
usage: jupyter.py [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
                  [--paths] [--json]
                  [subcommand]
 
Jupyter: Interactive Computing
 
positional arguments:
  subcommand     the subcommand to launch
 
optional arguments:
  -h, --help     show this help message and exit
  --version      show the jupyter command's version and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable
                 format.
  --json         output paths as machine-readable json
Available subcommands: 1.0.0

或者输入python -m jupyter。


4,Linux Ubuntu在以上无法解决,还是出现:jupyter: command not found 的报错的时候:


1,在机器上查找jupter安装的位置(如果之前没有安装,请按上文方法安装)
$ sudo find / -name 'jupyter'
 
# 输出中可能会发现:
/home/user/.local/share/jupyter
/home/user/.local/etc/jupyter
/home/user/.local/bin/jupyter
...
 
2,带有Bin的就是。此时需要在环境变量中加入该位置
$ vi ~/.bashrc
加入一行 export PATH=$PATH:/home/user/.local/bin
$ source ~/.bashrc
3,此时再在终端输入Jupyter notebook,应该可以打开了
 
 
注:
~/.bashrc与/etc/profile的区别:~/.bashrc: 用于指定用户,/etc/profile: 用于全局所有用户


41.2466
0
关注作者
收藏
评论(0)

发表评论

暂无数据