jupyter默认代码自动补全是关闭的,要打开自动补全,需修改默认配置。
在WIndows开始菜单中找到Anaconda,打开了Anaconda Prompt,
命令行中输入:
ipython profile create
以上命令会在C:\User\$你的用户名\.ipython\profile_default\目录下生成ipython_config.py和ipython_kernel_config.py
## Activate greedy completion PENDING DEPRECTION. this is now mostly taken care
# of with Jedi.
#
# This will enable completion on elements of lists, results of function calls,
# etc., but can be unsafe because the code is actually evaluated on TAB.
c.Completer.greedy = True
## Experimental: restrict time (in milliseconds) during which Jedi can compute
# types. Set to 0 to stop computing types. Non-zero value lower than 100ms may
# hurt performance by preventing jedi to build its cache.
c.Completer.jedi_compute_type_timeout = 400
## Experimental: Use Jedi to generate autocompletions. Off by default.
c.Completer.use_jedi = True
重启jupyter后生效。
# 以上操作后,在编写代码是发现不是自动不全,是要按下tab键才可以补全,每次还要手动tab一下。比较麻烦
打开Anaconda Prompt,使用命令 pip install jupyter_contrib_nbextensions ,默认是从官方源下载数据,比较慢而且容易中断报错;
执行如下命令将pip安装源切换到国内阿里云
pip install web.py -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
以下pip源可供选择:
#阿里云 http://mirrors.aliyun.com/pypi/simple/
#中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
#豆瓣(douban) http://pypi.douban.com/simple/
#清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
#中国科学技术大学http://pypi.mirrors.ustc.edu.cn/simple/
# pip install jupyter_contrib_nbextensions
# jupyter contrib nbextension install --user
# pip install jupyter_nbextensions_configurator
# jupyter nbextensions_configurator enable --user
按照如下配置