Python开发笔记之一——安装Jupyter Notebook

时间:2020-12-14 22:49:57

1、PIP的安装

首先我们需要安装pip,通过pip来安装jupyter;pip的安装之前需要去这里https://bootstrap.pypa.io/get-pip.py下载get-pip.py文件(文件有点大,有点慢,耐心等待);

文件下载下来执行如下命令:

➜  python sudo easy_install pip

在执行过程中,你可能会遇到如下问题:

Python开发笔记之一——安装Jupyter Notebook

别紧张,这一般都是网络原因导致,我切换下我的移动4G网络就OK了。安装如下:

Python开发笔记之一——安装Jupyter Notebook

2、安装jupyter

使用下面命令:

➜  python sudo pip install jupyter

如果老是碰到下面问题,切换了移动4G网络就OK了,看来还是网络不行。

Python开发笔记之一——安装Jupyter Notebook

到这一步安装其实并没有成功,碰到了下以下问题:

出现了setuptools-1.1.6的问题,搜索了一下资料,这里有个解决方案https://segmentfault.com/a/1190000005660498,步骤如下:

第一步:卸载之前的pip安装

➜  python sudo pip uninstall pip

Python开发笔记之一——安装Jupyter Notebook

第二步:采取get-pip.py官方安装:

➜  python python get-pip.py --user

第三步:打开.bash_profile文件:

➜  python vim ~/.bash_profile

编辑如下内容:

if [ -d $HOME/Library/Python/2.7/bin ]; then
export PATH=$HOME/Library/Python/2.7/bin:$PATH
fi

然后别忘记source .bash_profile

第四步:配置pip参数:

➜  python cd ~

➜  ~ mkdir -p .pip

➜  ~ cd .pip

➜  .pip touch pip.conf

➜  .pip vim pip.conf

写入如下内容:

[global] default-timeout = 60

download-cache = ~/.pip/cache

log-file = ~/.pip/pip.log

[installindex-url = https://pypi.douban.com/simple

第五步:执行jupyter安装

➜  .pip pip install jupyter --user

Python开发笔记之一——安装Jupyter Notebook

ok,安装成功。

执行如下命令:

➜  .pip jupyter notebook

即可得到jupyter页面:

Python开发笔记之一——安装Jupyter Notebook

Python开发笔记之一——安装Jupyter Notebook

也可以切倒下面目录执行:

Python开发笔记之一——安装Jupyter Notebook

3、参考资料

http://blog.csdn.net/mytoast/article/details/52676411

https://segmentfault.com/a/1190000005660498

http://jupyter.readthedocs.io/en/latest/install.html

https://pip.readthedocs.io/en/stable/installing/#install-pip