Centos7下安装ipython和jupyter的详细教程

Centos7下安装ipython和jupyter的详细教程

1.配置静态网络:
vim /etc/sysconfig/network-scripts/ifcfg-ens33
添加GATEWAY、IPADDR、NETMASK,把BOOTPROTO的dhcp改成static
2.如果要配置dns解析,则需要查看此文档/etc/resolv.conf里面的nameserver是否为网关。
3.git安装
yum install git -y
python的编译依赖

yum -y install gcc mack patch zlib-devel bzip2-devel openssl-devel sqlite-devel readline-devel gdbm-devel 

3.useradd python,切换用户

su - python

4.在python用户下安装pyenv

 curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
   此处是下载一个pyenv-install的一个shell脚本。此处可能会有个cul:(35) ssl connect error的情况,主要是centos6.5之前的,是因为nss版本过低,更新yum源,
# vim /etc/yum.repos.d/dvd.repo ,往里面添加下面的内容,接着# yum repolist

然后跟新nss

#yum update nss

5.安装完pyenv后,会有个提示,在pyhton用户下~/.bash_profile中追加下面三句话
在这里插入图片描述
然后source ~/.bash_profile或者重新登入
4.pyenv的使用
1.python版本及路经

 $ python --version
  $ python -V
  $ echo $PATH

2.pyenv命令
在这里插入图片描述
离线安装:

1.cd .pyenv
2.mkdir cache
3.把Python-3.5.3.tar.xz,Python-3.5.3.tgz,Python-3.5.3.tar.gz放到cache中,回到.pyenv执行pyenv install 3.5.3

2.pyenv version和pyenv versions
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

$ mkdir -p magedu/projects/web
$ cd magedu/projects/web
$ pyenv local 3.5.3

虚拟:
$pyenv virtualenv 3.5.3 mag353

在所需的文件夹里$pyenv local mag353
在虚拟环境下安装ipython

  1. 国外:pip install ipython
  2. 阿里:/目录下$创建.pip
  3. mkdir .pip
  4. cd .pip,touch pip.conf,vim pip.conf
[global]
index-url=https://mirrors.aliyun.com/pypi/simple/
trusted-host=mirrors.aliyun.com

3.使用pip install ipthon时候出现以下问题:
Could not find a version that satisfies the requirement ipython==1.2.1 (from versions: )
No matching distribution found for ipython
这是因为ssl证书没有认证,可以使用国内的镜像
pip install ipython -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
出现此原因是你使用国外和没有重新登陆

Pip install jupyter
jupyter notebook –help
jupyter notebook –ip=0.0.0.0

ss -tanl
关闭防火墙:

systemctl stop firewalld.service 
systemctl disable firewalld.service

执行jupyter notebook

在这里插入图片描述

发布了7 篇原创文章 · 获赞 5 · 访问量 588

猜你喜欢

转载自blog.csdn.net/qq_44902875/article/details/103962096