日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python pip国内源_【Python】设置pip源为国内源及简单操作

發布時間:2025/4/16 python 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python pip国内源_【Python】设置pip源为国内源及简单操作 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、pip國內源鏡像:

二、修改源方法:

1.臨時修改

可以在使用pip的時候在后面加上-index參數,指定pip源:

pip install --index https://pypi.tuna.tsinghua.edu.cn/simple requests

2.配置文件

Linux

①修改 ~/.pip/pip.conf (沒有就創建一個), 內容如下:

[root@localhost .pip]# cat ~/.pip/pip.conf

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

②使用:

[root@localhost .pip]# pip install xlwt

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple

Collecting xlwt

Downloading https://pypi.tuna.tsinghua.edu.cn/packages/44/48/def306413b25c3d01753603b1a222a011b8621aed27cd7f89cbc27e6b0f4/xlwt-1.3.0-py2.py3-none-any.whl (99 kB)

|████████████████████████████████| 99 kB 735 kB/s

Installing collected packages: xlwt

Successfully installed xlwt-1.3.0

Windows:

①在我的電腦上的地址欄輸入:%appdata% ,然后回車;

②在里面新建一個名為 pip 的文件夾;

③在 pip 文件夾里面新建一個文件叫做 pip.ini ,內容寫如下即可。實際就是這么一個文件 : %appdata%\pip\pip.ini。

文件內容如下:

[global]

timeout = 6000

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

trusted-host = pypi.tuna.tsinghua.edu.cn

④使用pyreadline庫,可實現Windows中python的tab鍵補全,安裝如下:

C:\Users\annie.wu>pip install pyreadline

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple

Collecting pyreadline

Downloading https://pypi.tuna.tsinghua.edu.cn/packages/bc/7c/d724ef1ec3ab2125f38a1d53285745445ec4a8f19b9bb0761b4064316679/pyreadline-2.1.zip (109kB)

|████████████████████████████████| 112kB 1.1MB/s

Installing collected packages: pyreadline

Running setup.py install for pyreadline ... done

Successfully installed pyreadline-2.1

WARNING: You are using pip version 19.2.3, however version 20.1 is available.

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

3.簡單操作

①接下來,用 pip 試試安裝各種庫:

pip install xlwt

pip install xlrd

pip install six

pip install requests

pip install oauthlib

pip install requests_oauthlib

②其他使用示例

升級pip

python -m pip install -U pip

安裝相關庫

python -m pip install psutil

卸載相關庫

python -m pip uninstall psutil

查看已安裝的庫

python -m pip freeze

總結

以上是生活随笔為你收集整理的python pip国内源_【Python】设置pip源为国内源及简单操作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。