189 8069 5689

jupyter安装相关-创新互联

1.安装python3.5.7

wget https://www.python.org/ftp/python/3.5.7/Python-3.5.7.tgz

成都创新互联是一家业务范围包括IDC托管业务,网页空间、主机租用、主机托管,四川、重庆、广东电信服务器租用,服务器托管雅安,成都网通服务器托管,成都服务器租用,业务范围遍及中国大陆、港澳台以及欧美等多个国家及地区的互联网数据服务公司。

tar -zxvf Python-3.5.7.tgz

cd Python-3.5.7

./configure --prefix=/usr/local/python-3.5.7

make

make install

ln /usr/local/python-3.5.7/bin/python3 -s /usr/bin/python3
ln /usr/local/python-3.5.7/bin/pip3 -s /usr/bin/pip3

2.安装jupyter

参考https://www.cnblogs.com/noahzhixiao/p/9985566.html

  1. 安装ipython, jupyter
    pip install ipython
    pip install jupyter

  2. 生成配置文件

[root@50eb5057baac /]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

  1. 生成密码

root@50eb5057baac /]# ipython Python 3.5.1 (default, Oct 21 2016, 21:37:19)
Type 'copyright', 'credits' or 'license' for more information IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:43b95b731276:5d330ee6f6054613b3ab4cc59c5048ff7c70f549' In [3]:

  1. 修改默认配置文件

vi /root/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='' #设置访问notebook的ip,表示所有IP,这里设置ip为都可访问 c.NotebookApp.password = u'sha1:5df252f58b7f:bf65d53125bb36c085162b3780377f66d73972d1' #填写刚刚生成的密文 c.NotebookApp.open_browser = False # 禁止notebook启动时自动打开浏览器(在linux服务器一般都是ssh命令行访问,没有图形界面的。所以,启动也没啥用)
c.NotebookApp.port =8889 #指定访问的端口,默认是8888。
并去掉前面的注释 #

  1. 启动jupyter notebook --no-browser

[plain] view plain copy [root@346086094cbe /]# jupyter notebook --allow-root [W 17:17:04.106 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended. [I 17:17:04.111 NotebookApp] Serving notebooks from local directory: / [I 17:17:04.112 NotebookApp] 0 active kernels [I 17:17:04.112 NotebookApp] The Jupyter Notebook is running at: [I 17:17:04.112 NotebookApp] http://[all ip addresses on your system]:8889/ [I 17:17:04.112 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

  1. 然后你就可以在浏览器里敲入你的地址 http://yourip:8889/, 看到如下界面。

安装成功

  1. 启动Jupyter的开发窗口,点击右上角的new

3.安装依赖包

正常情况下是打不开jupyter的,所以需要安装依赖包
参考https://www.cnblogs.com/ligh-test/p/10028850.html

  1. no mudole named _sqlite3
  1. mportError: dynamic module does not define module export function (PyInit__caffe)

其实这两个问题都是因为python3以上版本不太支持sqlite3,下面的方法是亲测没问题,来自(sparkexpert大神)
(1)安装sqlite3的包
$ wget https://www.sqlite.org/2017/sqlite-autoconf-3170000.tar.gz --no-check-certificate
$ tar zxvf sqlite-autoconf-3170000.tar.gz
$ cd sqlite-autoconf-3170000
$ ./configure --prefix=/usr/local/sqlite3 --disable-static --enable-fts5 --enable-json1 CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1"
(2)对python3进行重新编译

$ cd Python3.5.7 (python下载解压后的目录)
$ LD_RUN_PATH=/usr/local/sqlite3/lib ./configure LDFLAGS="-L/usr/local/sqlite3/lib" CPPFLAGS="-I /usr/local/sqlite3/include"
$ LD_RUN_PATH=/usr/local/sqlite3/lib make
$ LD_RUN_PATH=/usr/local/sqlite3/lib sudo make install
经过上述步骤后,应该就没有什么问题了,控制台输入python3进入环境

import sqlite3没报错说明ok

4.添加spark依赖

修改.bashrc
增加:
export SPARK_HOME=/opt/cloudera/parcels/CDH/lib/spark
export PATH=$SPARK_HOME/bin:$PATH

export PYTHONPATH=/usr/local/python-3.5.7:$PYTHONPATH
export PYSPARK_PYTHON=python3

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章题目:jupyter安装相关-创新互联
文章出自:http://cdxtjz.cn/article/dpieis.html

其他资讯