Python相关收集
Python更换源
国内每个程序员的痛[捂脸]
Linux
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
Windows 10
笨办法
直接在user
目录中创建一个pip
目录,如:C:\Users\xx\pip
,新建文件pip.ini
,在文件中填写配置内容,如下:
[global]
index-url = https://pypi.doubanio.com/simple/
推荐的是豆瓣源,这是感情原因。实际中使用的是阿里源,https://mirrors.aliyun.com/pypi/simple/
好办法
跟Linux一样的操作。我也不明白,为什么好多Windows教程,都是上面这么写的。。。
Jupyter-Notebook
更换主题
安装jupyterthemes
pip install jupyterthemes
查看主题
jt -l
我的配置
jt -t onedork -f source -nf source -tf source -cellw 95% -T
深色系的几个主题:
chesterish
gruvboxd
monokai
oceans16
onedork
solarizedd
命令参数说明:
内置字体:
只列出了mono字体
前面是设置字体时使用的简称,后面是全称。
'anka': ['Anka/Coder', 'anka-coder'],
'anonymous': ['Anonymous Pro', 'anonymous-pro'],
'aurulent': ['Aurulent Sans Mono', 'aurulent'],
'bitstream': ['Bitstream Vera Sans Mono', 'bitstream-vera'],
'bpmono': ['BPmono', 'bpmono'],
'code': ['Code New Roman', 'code-new-roman'],
'consolamono': ['Consolamono', 'consolamono'],
'cousine': ['Cousine', 'cousine'],
'dejavu': ['DejaVu Sans Mono', 'dejavu'],
'droidmono': ['Droid Sans Mono', 'droidmono'],
'fira': ['Fira Mono', 'fira'],
'firacode': ['Fira Code', 'firacode'],
'generic': ['Generic Mono', 'generic'],
'hack': ['Hack', 'hack'],
'hasklig': ['Hasklig', 'hasklig'],
'iosevka' : ['Iosevka', 'iosevka'],
'inputmono': ['Input Mono', 'inputmono'],
'inconsolata': ['Inconsolata-g', 'inconsolata-g'],
'liberation': ['Liberation Mono', 'liberation'],
'meslo': ['Meslo', 'meslo'],
'office': ['Office Code Pro', 'office-code-pro'],
'oxygen': ['Oxygen Mono', 'oxygen'],
'roboto': ['Roboto Mono', 'roboto'],
'saxmono': ['saxMono', 'saxmono'],
'source': ['Source Code Pro', 'source-code-pro'],
'sourcemed': ['Source Code Pro Medium', 'source-code-medium'],
'ptmono': ['PT Mono', 'ptmono'],
'ubuntu': ['Ubuntu Mono', 'ubuntu']
设置快捷键
在页面中,非输入状态下,按H
,点击编辑快捷键
,然后就可以开始编辑了。说明在页面最下面。
toggle toolbar Alt-T
close and halt Alt-W
rename notebook Alt-R
clear all cells output Alt-O
toggle toc Alt-M
插件
安装扩展的程序
pip install jupyter_nbextensions_configurator jupyter_contrib_nbextensions
安装到notebook中
jupyter contrib nbextension install --user
其实,我没用下面的命令,就已经可以在notebook中,启用、停用插件了。
jupyter nbextensions_configurator enable --user
设置 Jupyter Notebook 外网远程访问
先生成配置文件
jupyter notebook --generate-config
# 生成后,会显示存放位置
顺手设置一下,外网访问时候的密码
jupyter notebook password
编辑jupyter_notebook_config.py
# 在所有的网卡接口上开启服务,或者设置白名单IP
c.NotebookApp.ip='*'
# 可自行指定一个端口
c.NotebookApp.port =8888
# 允许远程访问
c.NotebookApp.allow_remote_access = True