概述
Jupyter notebook里的代码有py2.7也有py3.0的,本文讲解如何使Jupyter同时支持多个python版本(python2.7.5 + python3.6.2)。
#cenos7默认安装了python2.7.5
[work@mars ~]$ python -V
Python 2.7.5
#安装python3依赖
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y
#安装python3
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
tar -xvJf Python-3.6.2.tar.xz
cd Python-3.6.2
./configure prefix=/usr/local/python3 #指定安装位置
su root
make && make install
#添加软链
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
#检查版本
[root@mars ~]# python3 -V
Python 3.6.2
[root@mars ~]# pip3 install --upgrade pip
#安装常用python3 lib
[work@mars ~]# sudo pip3 install ipykernel numpy joblib keras tensorflow matplotlib pydot
#Jupyter注册python3内核
[work@mars jupyter]$ python3 -m ipykernel install --user
Installed kernelspec python3 in /home/work/.local/share/jupyter/kernels/python3
刷新jupyter,查看可选的kernel,会多出python3选项:
最后
以上就是背后云朵为你收集整理的jupyter python_Jupyter Notebook支持多python版本的全部内容,希望文章能够帮你解决jupyter python_Jupyter Notebook支持多python版本所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复