【人工智能】Python安裝,Anaconda安裝,pip鏡像源,IDEA配置Python

1 Python安裝(Linux)

安裝包下載地址:https://www.python.org/downloads/source/

選擇當前最新版本:3.8.3版本

選擇源碼安裝:

下載解壓,到解壓路徑下執行:

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
./configure
make
make install

ps:如果安裝過程中出現問題,說明缺少一些必要的基礎庫,如,gcc。補上即可。

2 Anaconda安裝(Windows)

安裝包下載地址:https://www.anaconda.com/products/individual

選擇當前最新版本:3.7

選擇Windows安裝包:

安裝過程簡單,基本上都是下一步,略。

打開命令行驗證:

3 pip鏡像源

windows下創建: C:\Users\{用戶名}\{somepath}\pip\pip.ini

linux下創建: ~/.pip/pip.conf

pypi 鏡像使用幫助

pypi 鏡像每 5 分鐘同步一次。

臨時使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

設爲默認

升級 pip 到最新的版本 (>=10.0.0) 後進行配置:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

如果您到 pip 默認源的網絡連接較差,臨時使用清華鏡像站來升級 pip:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

如果linux環境下沒有pip,則執行安裝:

$ wget https://bootstrap.pypa.io/get-pip.py
$ python3 get-pip.py
$ pip3 -V 

驗證:

發現走的是清華的鏡像源:

配置多個鏡像源:如下

[global]
timeout=60
index-url=http://pypi.tuna.tsinghua.edu.cn/simple/
extra-index-url=
     https://mirrors.aliyun.com/pypi/simple/
     http://pypi.douban.com/simple/
     http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=
     pypi.tuna.tsinghua.edu.cn
     mirrors.aliyun.com
     pypi.douban.com
     pypi.mirrors.ustc.edu.cn

4 IDEA配置Python開發

插件中搜索Python插件安裝即可。安裝成功後,重啓IDEA生效。

 

 


愛家人,愛生活,愛設計,愛編程,擁抱精彩人生!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章