前提:安装了miniconda
1、安装jupyter
python3 -m pip install jupyter
2、生成jupyter配置文件
#root用户:
jupyter notebook --generate-config --allow-root
#非root用户
jupyter notebook --generate-config
/home/mydev/.jupyter/jupyter_notebook_config.py
3、打开ipython,生成密码
ipython
from notebook.auth import passwd
passwd() – 输入密码并按回车确认
输入密码后,会生成秘钥,稍后用到,
4、修改配置文件
vi /home/mydev/.jupyter/jupyter_notebook_config.py
– 允许访问的IP
c.NotebookApp.ip = ‘*’
– ipynb文件保存地址
c.NotebookApp.notebook_dir = ‘/home/mydev/app/jupyder’
c.NotebookApp.open_browser = False
c.NotebookApp.password = u’sha1:*********’
c.NotebookApp.port = 8888
5、启动jupyter
. ~/.bash_conda
conda activate common
– root用户
jupyter notebook --allow-root
– 非root用户
jupyter notebook
6、浏览器访问
http://xxx.xx.xx.xxx:8888 输入密码
7、关闭jupyter
netstat -ntulp | grep 8888
[mydev@i-siqi03 ~]$ netstat -ntulp | grep 8888
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 32889/python3
tcp6 0 0 :::8888 :::* LISTEN 32889/python3
kill -9 32889
8、安装数据挖掘包
conda list
conda install numpy
conda install matplotlib
conda install scipy
conda install pandas
conda install statsmodels
conda install scikit-learn
9、jupyter代码自动补全
#安装nbextensions
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
#安装nbextensions_configurator
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user
重启jupyter,在根目录下,点击Nbextensions标签页,勾选Hinterland即可。
参考:Linux下安装配置Jupyter notebook并启动_青山呦的博客-优快云博客_linux安装jupyter notebook