-
python 本地编译器jupyter安装
背景:
pycharm 证书总是过期,所以自己安装一个免费的本地编译环境
mac 安装jupyter:
首先:访问https://www.anaconda.com/distribution/#macos
安装自己的python环境,选择人不同版本的下载,我选择2.7
下载下来后,一路next,安装完成
然后:
进入anaconda的bin文件下,生成很多的命令行,在此可启动启动jupyter 启动命令为 jupyter -notebook
或者在launchpad上找到Anaconda-Navigator 的图标,launch一下jupyter(等效于在bin文件下 jupyter -notebook)
坑1:上述方式可能会导致jupyter进程崩溃,报错如下:
Traceback (most recent call last): File "/opt/anaconda2/bin/jupyter-notebook", line 11, in <module> sys.exit(main()) File "/opt/anaconda2/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) File "/opt/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 663, in launch_instance app.initialize(argv) File "</opt/anaconda2/lib/python2.7/site-packages/decorator.pyc:decorator-gen-7>", line 2, in initialize File "/opt/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 89, in catch_config_error app.print_help() File "/opt/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 386, in print_help self.print_subcommands() File "/opt/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 378, in print_subcommands print(os.linesep.join(lines)) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range(128) (base) ansonwan@localhost/opt/anaconda2/bin14:58:40/opt/anaconda2/bin$LANG=zn jupyter notebook
解决办法是,在bin文件下,使用如下命令启用jupyter
LANG=zn jupyter notebook
此时在本地网页上就可以访问jupyter了
坑2:jupyter启动之后,打开的project 默认是jupyter的安装目录而不是自己的工程目录
首先使用:LANG=zn jupyter notebook --generate-config查找jupyter_notebook_config.py 文件
找到后,将#c.NotebookApp.notebook_dir = u'' 注释去掉,然后将自己的工程目录替换当前的默认路径
变成c.NotebookApp.notebook_dir = '/xxx/xxx/xxx'
再重启jupyter后,jupyter打开的就是自己的工程目录了
原文:https://www.cnblogs.com/ansonwan/p/12132805.html