安装jupyter notebook
起因
看一篇关于其他内容的教程贴,作者推荐的
看起来像ipython,调试、测试函数功能应该很方便,
安装
python3 -m pip install jupyter
启动
jupyter
command not found
搜索后发现好像win可以这么运行,但是macOS不行
通过python3 -m IPython notebook
运行成功:
开始使用:
设置默认文件存放位置 配置
python3 -m jupyter --config-dir
查找配置文件位置:
使用vim打开配置文件,并加入一句话,来设置默认打开地址:
修改路径后,再打开,默认地址变成了配置的地址:/Desktop/jupyter_file
查看默认配置文件 新建自己的配置
通!ipython profile locate default
命令查看默认配置文件的位置
command not found ipython
参考
ipython指令通常找不到,因为python3中需要通过以下指令执行:!python3 -m IPython profile locate default
(python3中,调用modul需要通过python3 -m
的形式)
如果还想用ipython
指令,可以在.bash_profile
文件中使用alias
指令——即,在.bash_profile
文件中加入下面一行:alias ipython='python3 -m IPython'
修改后记得source ./.bash_profile
然后就可以直接在终端ipython
了!解决
bash_profile
重启终端会失效
参考
原因:
bash_profile中的内容只对当前窗口有效需要先source才能生效- ~~ ~~macOS默认使用的是zsh不是bash
解决办法:编辑~~~/.zshrc~~
文件,加入~~source~~
语句
~~~/.zshrc~~
文件好像是开机启动?有疑问
解决办法:把.bash_profile中的内容拷贝到.zshrc,如果没有就新建
再打开新的终端窗口,直接运行ipython,可行解决