[转]Linux中python3.6+ipython+Jupyter Notebook环境
python3.6安装
- 下载python安装包,这里下载的最新的3.6.1版本
https://www.python.org/ftp/python/3.6.1/ - 将安装包上传到服务器并解压
tar zxvf Python-3.6.1.tgz
- 安装python
cd Python-3.6.1
./configure --prefix=/usr/local/python-3.6.1 #重要,指定python的安装路径,可以自己设置。
make
sudo make install
- 修改python的软链接 (建立软链接,变为全局)
sudo ln -s /usr/local/python-3.6.1/bin/python3.6 /usr/bin/python
- 查看python版本,发现已经改变
python
ipython安装
- 下载ipython,并上传到服务器
http://archive.ipython.org/release/6.0.0/ - 解压
tar -zxvf ipython-6.0.0.tar.gz
- 进入解压的ipython目录并执行如下命令进行安装
python setup.py install
- 进行链接
ln -s /usr/local/python-3.6.1/bin/ipython /usr/sbin/ipython
- 检查ipython是否安装成功
ipython

此时发现提示说有模板缺失,使用pip进行安装。
pip install traitlets
再执行ipython进行检验,发现还是某个模板缺失

继续用pip进行安装,知道执行ipython时出现如下界面,代表安装成功。

Jupyter Notebook安装
Jupyter Notebook(此前被称为 IPython notebook)是一个交互式笔记本,支持运行 40 多种编程语言。Notebook是一个数据分析和编写代码的好工具。它的核心在于展示与快速迭代。
摘自:知乎为什么使用jupyter?
看完知乎的这个回答会对jupyter有个大概的认知,接下来进行安装。
- 安装jupyter notebook
pip install jupyter notebook
- 启动notebook
jupyter notebook
此时报错,不建议用root运行启动命令:
[I 16:23:40.195 NotebookApp] Writing notebook server cookie secret to /root/.local/t
[C 16:23:40.213 NotebookApp] Running as root is not recommended. Use --allow-root t.
解决方法:
- 修改配置文件,执行jupyter notebook --generate-config即可初始化配置文件来,但是这里要加入--allow-root才行
[root@localhost ~]# jupyter notebook --generate-config --allow-root
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
- 创建一个密码:[这样就不用每次复制URL地址]
[root@localhost ~]# ipython
Python 3.6.1 (default, May 25 2017, 16:49:43)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.0.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:f6ac161e9215:dc0eb8c8d43b74e32bb03db161e3261ea5d7c297'
将这里的 ```
'sha1:f6ac161e9215:dc0eb8c8d43b74e32bb03db161e3261ea5d7c297'
* 修改配置文件中的IP地址、工作目录、并添加一个认证密码:
[root@localhost .jupyter]# vim /root/.jupyter/jupyter_notebook_config.py
修改权限
c.NotebookApp.allow_root = False
去掉行注释,并修改成True即可解决root权限运行的问题。
设置,外部可访问
c.NotebookApp.ip = 'localhost'
去掉注释,并把localhost改成0.0.0.0,这样就可以外部访问了,默认只有在本机可以访问的;
c.NotebookApp.ip = '0.0.0.0'
设置notebook的工作目录
c.NotebookApp.notebook_dir = u''
改成如下,这样就会默认把notebook上创建的文件保存到指定目录下;需要事先创建。
c.NotebookApp.notebook_dir = u'/opt/jupyter'
加入密码
c.NotebookApp.password = u''
加入上面创建的密码:
c.NotebookApp.password = u'sha1:f6ac161e9215:dc0eb8c8d43b74e32bb03db161e3261ea5d7c297'
3. 进入notebook界面
再次执行启动命令,出现如下信息,表示成功
[root@localhost .jupyter]# jupyter-notebook
[I 18:09:58.194 NotebookApp] Serving notebooks from local directory: /opt/jupyter
[I 18:09:58.194 NotebookApp] 0 active kernels
[I 18:09:58.194 NotebookApp] The Jupyter Notebook is running at:
http://0.0.0.0:8888/bookApp]
在浏览器输入如下网址:http://你的ip:8888
可以看到如下界面:

**参考:**
[官方文档](https://jupyter.readthedocs.io/en/latest/install.html)
[centos7安装notebook 5.0.0的方法](https://www.58jb.com/html/146.html)
作者:夏无忧阳
链接:https://www.jianshu.com/p/0133f79a12db
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
vim /etc/systemd/system/shadowsocks.service
systemctl daemon-reload
systemctl status shadowsocks -l
systemctl start shadowsocks
[转]Linux中python3.6+ipython+Jupyter Notebook环境的更多相关文章
- 如何在Python中快速画图——使用Jupyter notebook的魔法函数(magic function)matplotlib inline
如何在Python中快速画图--使用Jupyter notebook的魔法函数(magic function)matplotlib inline 先展示一段相关的代码: #we test the ac ...
- Linux中python3,django,redis以及mariab的安装
1. Linux中python3,django,redis以及mariab的安装 2. CentOS下编译安装python3 编译安装python3.6的步骤 1.下载python3源码包 wget ...
- Jupyter Notebook环境安装
Jupyter Notebook环境安装 一.什么是jupyter Notebook 1.简介 Jupyter Notebook 是基于网页的用于交互计算机的应用程序器可被应用程序. 能让用户将说明文 ...
- linux安装python3 ,安装IPython ,安装jupyter notebook
安装python3 下载到 /opt/中 1.下载python3源码,选择3.6.7因为ipython依赖于>3.6的python环境wget https://www.python.org ...
- linux中python3安装和使用
python安装 下载python安装包和依赖环境 #自由选择python3源码包的版本https://www.python.org/ftp/python/https://www.python.org ...
- 本地主机访问远程linux系统服务器上的jupyter notebook
1,机器情况:服务器 centos python环境已经配置好了,在虚拟环境下安装了anaconda 并且在里面安装了jupyter notebook 2,主机是 windows ipytho ...
- Ubuntu16.04部署python2和python3共存的Jupyter Notebook
一.安装python和python-pip sudo apt-get install python python3 python-pip python3-pip sudo pip install -- ...
- 【机器学习 Azure Machine Learning】使用Aure虚拟机搭建Jupyter notebook环境,为Machine Learning做准备(Ubuntu 18.04,Linux)
问题描述 在Azure的VM中已经安装好Jupyter,并且通过jupyter notebook --port 9999 已经启动,但是通过本机浏览器,访问VM的公网IP,则始终是不能访问的错误.(T ...
- [python之ipython] jupyter notebook在云端服务器上开启,本地访问
本地ssh到云端: ssh username@xxx.xxx.xxx.xxx -L127.0.0.1:7777:127.0.0.1:8888 把云端的8888端口映射到本地的7777端口 云端运行指令 ...
随机推荐
- Codeforces Round #552 (Div. 3) F. Shovels Shop (前缀和预处理+贪心+dp)
题目:http://codeforces.com/contest/1154/problem/F 题意:给你n个商品,然后还有m个特价活动,你买满x件就把你当前的x件中最便宜的y件价格免费,问你买k件花 ...
- dubbo的常用配置(基于注解)
之前记录了基于springboot的dubbo入门案例,今天在此基础上记录dubbo官网介绍的常用属性配置,dubbo读取我们配置的属性时是有优先级的,优先级如下图: 如图所示,优先级的属性依次为虚拟 ...
- mysql 数据库主从同步
1.简介 写这篇文章是网上找到的相关主从同步的都不够完全,本人第一次搭建主从同步,完全看着网上的文章来搭建的,结果你懂的,踩了很多坑.所以特地把踩到的坑写出来,新手切勿直接布置到正式环境,请于测试环境 ...
- OpenGL 3D旋转的木箱
学习自: https://learnopengl-cn.github.io/01%20Getting%20started/08%20Coordinate%20Systems/#3d 0,首先添加glm ...
- 18-09-11 软件rpm yum rm卸载 和批量删除
一 在Linux下删除文件用rm命令,具体用法如下: rm [选项] 文件 选项说明: -f -force 忽略不存在的文件,强制删除,无任何提示 -i --interactive 进行交互式地删除 ...
- c语言——鞍点
描述 找出具有m行n列二维数组Array的“鞍点”,即该位置上的元素在该行上最大,在该列上最小,其中1<=m,n<=10. 输入 输入数据有多行,第一行有两个数m和n,下面有m行,每行有n ...
- CSS grid 模板
在gridCSS属性速记属性显式设置所有的网格性质(grid-template-rows,grid-template-columns,和grid-template-areas和所有的网格性质(隐式gr ...
- jstl,el表达式
在上一篇中,我们写了将数据传到jsp页面,在jsp页面进行展示数组,但是我们发现,在jsp页面写代码是一件很烦的事,一个循环要拆成两部分,例如for循环,在例如if语句: <%int a=22; ...
- Python 多进程和多线程的效率对比
import time from threading import Thread from multiprocessing import Process def f1(): # time.sleep( ...
- Flask开发基础
Flask是一个使用Python编写的轻量级Web应用框架. 模板引擎使用的Jinja2 Flask框架简单易学,但是其保留了扩展的弹性,可以使用Flask-extension 加入ORM ,窗体验证 ...
