Fork me on GitHub

安装ipython和jupyter

本节内容;

  • 安装ipython
  • 安装jupyter
  • Pycharm介绍
  • Python软件包管理

 

一、安装ipython

1. python的交互式环境

 

2. 安装ipython

可以使用pip命令安装。如果你是用pyenv安装的python的话,pip命令已经有了。

当需要安装包的时候,最好进入虚拟环境,为了保持基础版本的干净。

[root@db test]# pyenv local cmdb
(cmdb) [root@db test]# pip install ipython

但是这样下载速度很慢,而且容易连接不上,ctrl+c终止。

# mkdir ~/.pip
# vim ~/.pip/pip.conf
[global]
timeout = 6000 
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com
# pip install ipython

 

二、安装jupyter

jupyter是一个可以让我们在浏览器上使用python环境。

# pip install jupyter
# jupyter -h | less
usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
               [--paths] [--json]
               [subcommand]

Jupyter: Interactive Computing

positional arguments:
  subcommand     the subcommand to launch

optional arguments:
  -h, --help     show this help message and exit
  --version      show the jupyter command's version and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable
                 format.
  --json         output paths as machine-readable json

Available subcommands: bundlerextension console kernel kernelspec migrate
nbconvert nbextension notebook qtconsole run serverextension troubleshoot
trust
(END)

  

子命令notebook会启动一个浏览器。

第一次访问时浏览器输入http://ip:8888/?token=b201c673885018b5a0b8e438139f978427bda8d190a4f4c5,我是在我自己笔记本上打开一个浏览器访问的。

点击右边“New”,选择“Python3”。这样会在浏览器打开一个新选项卡,如下。

补充说明:

参数 --no-browser 就不会在当前Linux主机上启动浏览器。

 

三、Python的IDE开发工具简介

Python对开发工具的要求不是很高的。PyCharm是基于IDEA开发的。IDEA可以以插件的形式安装python插件。

 

四、Python软件包管理

easy_insall的作用和perl中的cpan, ruby中的gem类似,都提供了在线一键安装模块的傻瓜方便方式,

而pip是easy_install的改进版, 提供更好的提示信息,删除package等功能。老版本的python中只有easy_install, 没有pip。

 
或者在Pycharm中安装包,

 

posted @ 2018-04-24 09:51  暴走小骚年  阅读(10011)  评论(0编辑  收藏  举报