参考链接:https://blog.csdn.net/simple_the_best/article/details/77005400
1、安装jupyter:sudo pip install jupyter
(个人先是激活了虚拟环境py2(在py3中没成功,原因待解决),然后在虚拟环境中安装的jupyter)
2、添加jupyter配置文件:jupyter notebook --generate-config
3、打开ipython,手动设置密码:
from notebook.auth import passwd
passwd()
复制'sha1'内容
4、修改配置文件:vi ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #随便指定一个端口
c.NotebookApp.notebook_dir =u'你的path'
5、启动:jupyter notebook--allow-root
(root用户)
6、在jupyter中使用pip install:
import pip def install(package): pip.main(['install', package]) install('pyquery')