Python Jupyter安装

安装Jupyter:

pip install Jupyter

打开notebook

Jupyter notebook

命令行提示错误

ModuleNotFoundError: No module named 'prompt_toolkit'

The solution for me was to pip uninstall prompt-toolkit and pip install prompt-toolkit. This uninstalled v1.0.5 and installed v2.0.4.

安装扩展

pip install jupyter_contrib_nbextensions

jupyter contrib nbextension install --user

此时打开浏览器就可以看见extensions项,如果没有,打开http://localhost:8888/nbextensions?这个配置也可以

自动补全

选中extensions中的Hiterland

cmd中输入ipython profile create

以上命令会在~/.ipython/profile_default/目录下生成ipython_config.pyipython_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后生效。

猜你喜欢

转载自blog.csdn.net/zm147451753/article/details/83006596