jupyter一些坑

安装jupyter时的报错

参考了冰梅的方法进行更新pip
python -m pip install --upgrade --force pip由于还是很慢所以选择用镜像
网上有很多可用的源,
例如豆瓣:http://pypi.douban.com/simple/

   清华:[https://pypi.tuna.tsinghua.edu.cn/simple](https://pypi.tuna.tsinghua.edu.cn/simple)

最近使用得比较多并且比较顺手的是清华大学的pip源,它是官网pypi的镜像,每隔5分钟同步一次,地址为 https://pypi.tuna.tsinghua.edu.cn/simple

临时使用:

可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple

例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent,这样就会从清华这边的镜像去安装gevent库。

永久修改,一劳永逸:

Linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

Windows命令行中输入jupyter notebook后无法自动跳转浏览器——解决方法

Windows系统下
cmd中输入
jupyter notebook --generate-config
根据提示的生成文件的地址打开Jupyter_notebook_config.py文件
找到文件中的
#c.NotebookApp.notebook_dir = ''
在其下方加入代码

import webbrowser
webbrowser.register("chrome",None,webbrowser.GenericBrowser(u"C:\\Users\\xxx\\AppData\\Local\\CentBrowser\\Application\\chrome.exe"))
c.NotebookApp.browser = 'chrome'

其中,C:\Users\xxx\AppData\Local\CentBrowser\Application\chrome.exe是自己的浏览器文件地址,我自己的是chrome,所以下方c.NotebookApp.browser填入chrome。
(请特别注意:文件路径中都是\双斜线

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容