一、集成開發環境
Windows:
Python + PyCharm
Python + Eclipse + PyDev
Linux:
Python + PyCharm
二、Python版本升級
在2.x版本中當前普遍使用的是2.7版本,如果系統自帶的python版本比較低,需要對自帶版本進行升級。(3.x版本的升級方法相同)
1、官網下載安裝包:
[root@localhost ~]# cd /opt/src/
[root@localhost src]# wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
2、編譯安裝
安裝依賴包:openssl-devel、zlib-devel、readline-devel、sqlite-devel
[root@localhost src]# tar zxf Python-2.7.10.tgz
[root@localhost src]# cd Python-2.7.10
[root@localhost Python-2.7.10]# ./configure --prefix=/usr/local/python2.7.10
[root@localhost Python-2.7.10]# make && make install
3、修改當前python命令版本
安裝完成後,查看python版本:
[root@localhost src]# python -V
Python 2.6.6
發現版本沒有改變,這時需要創建軟連接:
[root@localhost ~]#rm -f /usr/bin/python
[root@localhost ~]#ln -s /usr/local/python2.7.10/bin/python2.7 /usr/bin/python
再次查看版本:
[root@localhost ~]#python -V
Python2.7.10
升級版本後,由於yum只支持到python2.6,爲了防止yum失效,需要修改/usr/bin/yum文件:
[root@localhost ~]# vim /usr/bin/yum
第一行 #!/usr/bin/python修改爲#!/usr/bin/python2.6即可
三、ipython安裝
IPython是Python的交互式Shell,提供了代碼自動補完,自動縮進,高亮顯示,執行Shell命令等非常有用的特性。特別是它的代碼補完功能,例如:在輸入zlib.之後按下Tab鍵,IPython會列出zlib模塊下所有的屬性、方法和類。完全可以取代自帶的bash
yum安裝:
2版本的ipython只需要安裝epel源然後yum直接安裝就可,不需要手動安裝:
[root@localhost ~]#yum install epel-release -y
[root@localhost ~]#yum install ipython -y
安裝完之後運行ipython:
[root@localhost ~]# ipython
Python 2.7.5 (default, Apr 11 2018, 07:36:10)
Type "copyright", "credits" or "license" for more information.
IPython 3.2.1 -- An enhanced Interactive Python.
? -> 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]:
3版本的ipython3安裝只需要使用python3用下面命令安裝即可
[root@wing ~]# python3 -m pip install ipython
安裝完運行ipython3:
[root@wing ~]# ipython3
Python 3.6.2 (default, Sep 14 2017, 15:13:07)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: