Python安裝

1.linux自帶pythonpython

查看python版本方法linux

python -Vwindows

image.png

直接輸入python就進入了python命令行,exit()退出或者ctrl+d退出centos

 2.windows安裝python服務器

https://www.python.org/ide

image.png

image.png

選擇python3或者2均可以,這裏選擇2工具

image.png

根據電腦系統是32位仍是64位選擇對應版本,如今基本都是64位centos7

下載完以後一直下一步,默認安裝路徑在C:\Python27spa

將C:\Python27加入環境變量PATH命令行

而後打開命令行就能夠調用python(環境變量不生效的話就重啓下電腦)

image.png

3.python經常使用工具安裝

之後實驗都在centos7環境下,因爲默認python窗口沒有tab補全功能,這裏推薦一個工具ipython

安裝ipython

yum install -y epel-release

yum install -y python-pip

pip install ipython

我這裏安裝報錯

image.png

You are using pip version 8.1.2, however version 18.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

解決方法以下:執行

python -m pip install --upgrade pip

而後從新安裝ipython

image.png

若是ipython版本不對,就在網上查詢對應的版本號

pip install ipython==1.2.1

pip list(查看裝了哪些模塊)

https://pypi.python.org/pypi/ipython  ipython最新版本的連接,若是服務器沒有外網,能夠在這裏下載源碼包源碼安裝

源碼安裝方法

cd /usr/local/src/

wget https://files.pythonhosted.org/packages/41/a6/2d25314b1f9375639d8f8e0f8052e8cec5df511d3449f22c4f1c2d8cb3c6/ipython-5.8.0.tar.gz

tar zxvf ipython-5.8.0.tar.gz

cd ipython-5.8.0/

python setup.py --help  查看安裝方法

python setup.py install  安裝

相關文章
相關標籤/搜索