1. 程式人生 > >python配置國內映象

python配置國內映象



國內映象
http://pypi.douban.com/simple/ 豆瓣
http://mirrors.aliyun.com/pypi/simple/ 阿里
http://pypi.hustunique.com/simple/ 華中理工大學
http://pypi.sdutlinux.org/simple/ 山東理工大學
http://pypi.mirrors.ustc.edu.cn/simple/ 中國科學技術大學
https://pypi.tuna.tsinghua.edu.cn/simple 清華


使用辦法
1、臨時使用,新增“-i”或“--index”引數




[plain] view plain copy
pip install -i http://pypi.douban.com/simple/ flask  
2、配製成預設的
在你的“C:\Users\你的使用者名稱\”目錄下建立“pip”目錄,“pip”目錄下建立“pip.ini”檔案(注意:以UTF-8 無BOM格式編碼);
“pip.ini”檔案內容:




[plain] view plain copy
[global]  
index-url=http://mirrors.aliyun.com/pypi/simple/  
[install]  
trusted-host=mirrors.aliyun.com  


注意:trusted-host 選項為了避免麻煩是必須的,否則使用的時候會提示不受信任,或者新增“--trusted-host=mirrors.aliyun.com”選項;
注意:有網頁提示需要建立或修改配置檔案(linux的檔案在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini),至少Windows7下“%HOMEPATH%\pip\pip.ini”這個目錄是不起作用的。




--------------------------------------------------------------------------------------------------------
pycharm 三方包的設定


file -> settings -> project:projectName -> project interpreter -> 點選右邊的小齒輪,選擇自己的python的位置
(C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\python.exe) -> 新增完成後在當前介面右邊的工具欄點選
最下面的一個圖示 -> 進入新的對話方塊,選擇自己的三方包的位置 (C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\site-packages)


python預設安裝的路徑
C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\python.exe
預設的三方包的位置
C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\site-packages