本節內容;
- 安裝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中安裝包,