100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > Python及IPython安装使用

Python及IPython安装使用

时间:2021-01-30 02:51:29

相关推荐

Python及IPython安装使用

Python:面向对象的解释型计算机程序设计语言

IPython:一个交互式计算系统。主要包含三个组件:增加的交互式 “Python shell”,解耦的双过程通信模型,交互式并行计算的架构。支持变量自动补全。

IPython是一个 python 的交互式 shell,相对于python shell,增加了变量自动补全,自动缩进,支持 bash shell 命令,内置了其它有用的功能和函数。

特点:

强大的交互式shell

Jupyter 内核

交互式的数据可视化工具

灵活、可嵌入的解释器

易于使用,高性能的并行计算工具

1、编译安装Python

[root@test ~]# tar zxf Python-2.7.tgz

[root@test ~]# ll

[root@test ~]# cd Python-2.7

[root@test Python-2.7]# ll

总用量 848

-rwxr-x---1 1000 1002 402781 5月 28 configure

-rw-r-----1 1000 1002 124898 5月28 configure.in

drwxr-x--- 23 1000 1002 4096 7月 3 Demo

drwxr-x--- 17 1000 1002 4096 7月 3 Doc

drwxr-x---2 1000 1002 4096 7月 3 Grammar

drwxr-x---2 1000 1002 4096 7月 3 Include

-rwxr-x---1 1000 1002 7122 6月 14 install-sh

drwxr-x--- 47 1000 1002 12288 7月 3 Lib

-rw-r-----1 1000 1002 14231 7月 3 LICENSE

drwxr-x--- 11 1000 1002 4096 7月 3 Mac

-rw-r-----1 1000 1002 40618 4月 12 Makefile.pre.in

drwxr-x---5 1000 1002 4096 7月 3 Misc

drwxr-x---9 1000 1002 4096 7月 3 Modules

drwxr-x---3 1000 1002 4096 7月 3 Objects

drwxr-x---2 1000 1002 4096 7月 3 Parser

drwxr-x--- 10 1000 1002 4096 7月 3 PC

drwxr-x---2 1000 1002 4096 7月 3 PCbuild

-rw-r-----1 1000 1002 33981 5月 8 pyconfig.h.in

drwxr-x---2 1000 1002 4096 7月 3 Python

-rw-r-----1 1000 1002 53728 7月 3 README

drwxr-x---5 1000 1002 4096 7月 3 RISCOS

-rw-r-----1 1000 1002 88705 6月 27 setup.py

drwxr-x--- 22 1000 1002 4096 7月 3 Tools

查询编译参数帮助:

[root@test Python-2.7]# ./configure --help

安装依赖包

[root@test Python-2.7]# yum installreadline-devel

Installed:

readline-devel.x86_64 0:6.0-4.el6

Dependency Installed:

ncurses-devel.x86_64 0:5.7-4.0207.el6

Dependency Updated:

ncurses-base.x86_64 0:5.7-4.0207.el6

ncurses-libs.x86_64 0:5.7-4.0207.el6

编译安装Python

[root@test Python-2.7]# ./configure--prefix=/usr/local/python27

[root@test Python-2.7]# make & makeinstall

测试Python是否安装成功

[root@test Python-2.7]# /usr/local/python27/bin/python2.7

Python 2.7 (r27:82500, May 20 ,20:05:39)

[GCC 4.4.7 0313 (Red Hat 4.4.7-18)] onlinux2

Type "help","copyright", "credits" or "license" for moreinformation.

>>> print "hello world!"

hello world!

>>> exit()

2、安装IPython

[root@test Python-2.7]# cd

[root@test ~]# tar zxf ipython-1.2.1.tar.gz

[root@test ~]# cd ipython-1.2.1

[root@test ipython-1.2.1]# ls

COPYING.txtdocs examples IPythonPKG-INFO README.rst scriptssetupbase.py setupegg.py setupextsetup.py

安装ipython

[root@test ipython-1.2.1]#/usr/local/python27/bin/python2.7 setup.py build

[root@test ipython-1.2.1]#/usr/local/python27/bin/python2.7 setup.py install

[root@test ipython-1.2.1]# ls/usr/local/python27/bin/

2to3ipcontroller iptest pycolorpython2.7 smtpd.py

idleipengine ipython pydocpython2.7-config

ipclusteriplogger irunner pythonpython-config

创建链接文件

[root@test ipython-1.2.1]# ln -sv/usr/local/python27/bin/python2.7 /usr/bin/python27

"/usr/bin/python27" ->"/usr/local/python27/bin/python2.7"

[root@test ipython-1.2.1]# ln -sv/usr/local/python27/bin/ipython /usr/bin/

"/usr/bin/ipython" ->"/usr/local/python27/bin/ipython"

测试ipython是否安装成功

[root@test ipython-1.2.1]# ipython

WARNING: IPython History requires SQLite,your history will not be saved

Python 2.7 (r27:82500, May 20 ,20:05:39)

Type "copyright","credits" or "license" for more information.

IPython 1.2.1 -- An enhanced InteractivePython.

?-> Introduction and overview of IPython's features.

%quickref -> Quick reference.

help-> Python's own help system.

object?-> Details about 'object', use 'object??' for extra details.

In [1]: print "hello field"

hello field

In [2]: import platform

In [3]: print platform.

platform.DEV_NULL platform.python_compiler

platform.architecture platform.python_implementation

platform.dist platform.python_revision

platform.java_ver platform.python_version

platform.libc_ver platform.python_version_tuple

platform.linux_distribution platform.re

platform.mac_ver platform.release

platform.machine platform.string

platform.node platform.sys

platform.os platform.system

platform.platform platform.system_alias

platform.popen platform.uname

platform.processor platform.version

platform.python_branch platform.win32_ver

platform.python_build

In [3]: print platform.release

<function release at 0x2486848>

In [4]: print platform.release();

2.6.32-279.el6.x86_64

In [5]: print platform.version();

#1 SMP Fri Jun 22 12:19:21 UTC

In [6]: print platform.uname();

('Linux', '','2.6.32-279.el6.x86_64', '#1 SMP Fri Jun 22 12:19:21 UTC ', 'x86_64','x86_64')

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。