python -V
pip install jupyter
#root客户:
jupyter notebook --generate-config --allow-root
#非root客户
jupyter notebook --generate-config
值得一提的是:windows环境下,并没有jupyter_notebook_config.py这个配置文件,怎么办呢?
可以打开Anaconda Promote界面,执行上面相同的命令即可生成。
[root@xxj]# ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
会让输入两次密码,输入完成后 复制生成的 秘钥,后面会用到,秘钥带上sha1
vim /root/.jupyter/jupyter_notebook_config.py
#改几个地方:
c.NotebookApp.ip = 'xx.xxx.xx.xxx' 即对外提供访问的ip,云服务外网ip
c.NotebookApp.port = 8888 即对外提供访问的端口
c.NotebookApp.open_browser = False False即启动不打开浏览器
c.NotebookApp.password = u'sha1:XXXXX' 这个就是上面生成的秘钥
c.NotebookApp.notebook_dir = u'/opt/jupyter_dir' 即设置jupyter启动后默认的根目录
root用户,后台启动。非后台启动 去掉nohup
nohup jupyter notebook --allow-root&
非root用户
nohup jupyter notebook&
在本地浏览器打开:http://xxx.xx.xx.xxx:8888 即可访问了–当然你得输入密码,端口号为前面配置的端口号。
python -m pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user --skip-running-check
安装完成后,勾选 “Table of Contents” 以及 “Hinterland”。
首先是主题下载,命令行如下所示:
pip install --no-dependencies jupyterthemes==0.18.2
安装好了,有的电脑可能会提示缺少 lesscpy,继续 pip 安装
pip install lesscpy
然后是对主题选择、字体大小进行设置,例如
jt --lineh 140 -f consolamono -tf ptmono -t grade3 -ofs 14 -nfs 14 -tfs 14 -fs 14 -T -N
命令行的格式的解释如下表所示
cl options | arg | default |
---|---|---|
Usage help | -h | – |
List Themes | -l | – |
Theme Name to Install | -t | – |
Code Font | -f | – |
Code Font-Size | -fs | 11 |
Notebook Font | -nf | – |
Notebook Font Size | -nfs | 13 |
Text/MD Cell Font | -tf | – |
Text/MD Cell Fontsize | -tfs | 13 |
Pandas DF Fontsize | dfs | 9 |
Output Area Fontsize | -ofs | 8.5 |
Mathjax Fontsize (%) | -mathfs | 100 |
Intro Page Margins | -m | auto |
Cell Width | -cellw | 980 |
Line Height | -lineh | 170 |
Cursor Width | -cursw | 2 |
Cursor Color | -cursc | – |
Alt Prompt Layout | -altp | – |
Alt Markdown BG Color | -altmd | – |
Alt Output BG Color | -altout | – |
Style Vim NBExt* | -vim | – |
Toolbar Visible | -T | – |
Name & Logo Visible | -N | – |
Reset Default Theme | -r | – |
Force Default Fonts | -dfonts | – |
自己找个文件夹输入命令:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem
过程会让输入一些国家、城市等信息,随意输入即可。命令可能会出错,提示没有ca,如此出错就去自建ca
命令: find / -name CA
out: /etc/pki/tls/misc/CA
out:/etc/pki/CA
命令:cd /etc/pki/tls/misc/
命令:./CA -newca
out: writing new private key to '/etc/pki/CA/private/./cakey.pem'
然后执行上条命令,执行完后重新启动一下 notebook
默认已经安装好了对应的Python版本
#添加python2版本
python2 -m pip install ipykernel
python2 -m ipykernel install --user
#添加python3版本
python3 -m pip install ipykernel
python3 -m ipykernel install --user
1 若运行时报端口错误,修改启动参数再尝试
运行Jupyter时增加--ip=0.0.0.0参数
root@aliyun:~# jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
2 当运行 jupyter notebook 提示找不到命令 时,如果安装过程都正常,请尝试
jupyter-notebook
原因是安装后/usr/local/bin文件夹中(自己找安装位置,示例中是默认位置)只有 jupyter-notebook命令,可以使用软连接方式复制一份,命令进入/usr/local/bin文件夹后执行:
ln -s jupyter-notebook jupyter
3 当安装jupyter contrib nbextension install --user --skip-running-check 时报错
提示信息
cannot import name ‘create_prompt_application’ from 'prompt_toolkit.shortcut
解决办法: 装了 jupyter包,这个包依赖prompt-toolkit版本是2.0.0以上的版本,
而ipython包依赖的是1.0.15的版本,估计是装Jupyter时,将版本更新了,所以运行的时候报错
你把版本切成1.0.15即可,命令如下
pip install --upgrade prompt-toolkit==1.0.5
https://github.com/SpencerPark/IJava/releases 写作时间:2019.11.18
下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
备注:下载时,可以先在浏览器登录,登录后点击下载获取下载连接。直接在centos wget时会提示没有登录,所以需要先登录获取下载地址。
vi /etc/profile
把下面四个添加到文件的末尾
export JAVA_HOME=/usr/java/default
export JRE_HOME=\$JAVA_HOME/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
最后 source /etc/profile 保存退出。
依赖
Go 1.9+ - including GOPATH/bin added to your PATH (i.e., you can run Go binaries that you go install).
Jupyter Notebook or nteract
ZeroMQ 4.X.X - for convenience, pre-built Windows binaries (v4.2.1) are included in the zmq-win directory.
pkg-config 此为重点,好多电脑上默认没有
- yum install gcc-c++
git clone https://github.com/zeromq/libzmq
./autogen.sh && ./configure && make -j 4
make check && make install && sudo ldconfig
通过安装Go内核Gophernotes,Jupyter即可支持Go语言
配置环境变量 $GOPATH,默认该目录下有三个目录src bin pkg
export GOPATH=/opt/goHome #默认安装包的路径
go get -u github.com/gopherdata/gophernotes
mkdir -p ~/.local/share/jupyter/kernels/gophernotes
cp $GOPATH/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes
undefined reference to `zmq_curve_public’
gophernotes: symbol lookup error: gophernotes: undefined symbol:
zmq_curve_public
出错原因:动态库问题,下方解决方法
解决:
运行gophernotes的时候会出现 error while loading shared libraries:libzmq.so.5的错误,网上找找答案,https://www.cnblogs.com/codin… 参考这个帖子。