https://github.com/harmonsir/pip-fc
纯Python无依赖,帮助用户快速选择最佳镜像源,支持 Python >=2.7 & 3.x 。https://pypi.org/project/pip-fc/
https://github.com/harmonsir/pip-fc
pip
Last synced: 2 months ago
JSON representation
纯Python无依赖,帮助用户快速选择最佳镜像源,支持 Python >=2.7 & 3.x 。https://pypi.org/project/pip-fc/
- Host: GitHub
- URL: https://github.com/harmonsir/pip-fc
- Owner: harmonsir
- License: mit
- Created: 2025-10-29T12:38:23.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-01-10T05:58:44.000Z (5 months ago)
- Last Synced: 2026-01-11T01:44:33.245Z (5 months ago)
- Topics: pip
- Language: Python
- Homepage:
- Size: 45.9 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pip-fc
> pip-fc 全称是:pip fast check
`pip-fc` 是一个轻量级的 Python 工具,旨在测试多个镜像源的连接速度,并帮助用户选择最快的镜像源进行软件包安装。支持 Python 2.7 和 3.x 版本,能够自动根据环境选择适合的并发模式(`asyncio` 或 `threading`)。
---
## 功能
- 测试多个镜像源的连接速度。
- v0.1.12: 丢弃了部分过时的mirror,使用**文件实际下载速度**进行测速
- 自动选择连接速度最快的镜像源。
- 支持 Python 2.7 和 3.x 版本。
- 使用异步(`asyncio`)或线程池(`threading`)来提高测试效率。
- 简单易用的命令行界面。
## 安装
### 使用 `pip` 安装:
```bash
pip install pip-fc
```
## 使用方法
通过运行以下命令启动:
`pip-fc` 或者 `python -m pip_fc`
此命令将会测试预设的镜像源,并显示连接速度最快的镜像源。你也可以自定义镜像源进行测试。
### 设置全局镜像源
如果你希望将测试中找到的最快镜像源设置为全局 `pip` 镜像源,可以在运行完成后输入 `y` 来确认:
```bash
Do you want to set the fastest mirror as the global pip mirror? (y/n): y
```
此操作将更新 `pip` 的配置文件,设置全局镜像源和回退镜像源。
## 依赖
* `pip`:用于安装和管理 Python 包。
* `futures`:仅在 Python 2.7 环境下需要,安装时自动处理。
## 示例输出 v2
```
Detected Python Version: 3.12.12 (asyncio)
========================================
--- Starting HTTP download (v2) for speedtest (4096 bytes, 3 times average) ---
Mirror HTTP Download Test Results (sorted by speed):
----------------------------------------
Speed (KB/s) URL
----------------------------------------
27.53 https://mirrors.cloud.tencent.com/pypi/simple/
26.83 https://mirrors.ustc.edu.cn/pypi/simple/
16.45 https://pypi.tuna.tsinghua.edu.cn/simple/
16.39 https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
2.33 https://repo.huaweicloud.com/repository/pypi/simple/
0.51 https://mirrors.aliyun.com/pypi/simple/
----------------------------------------
*** Fastest mirror is: https://mirrors.cloud.tencent.com/pypi/simple/ (speed: 27.53 KB/s)
= = = = = = = = = = = = = = = = = = = =
Do you want to set the fastest mirror as the global pip mirror? (y/n):
Timeout reached! No input received.
Skipping mirror setup.
```
## 示例输出 v1
```
Detected Python Version: 3.8.5 (asyncio)
--- Starting connection speed test using asyncio mode ---
Successfully tested 6 mirrors.
Fastest Mirror: https://pypi.tuna.tsinghua.edu.cn/simple/
Latency: 50.12345 ms
--- All Successful Connection Results (URL, Latency in ms) ---
https://pypi.tuna.tsinghua.edu.cn/simple/: 50.12345 ms
https://mirrors.aliyun.com/pypi/simple/: 65.67890 ms
...
```
## 贡献
欢迎提出问题、提交 bug 或者贡献代码。如果你有任何问题,或者希望添加新特性,请提交 [issue](https://github.com/harmonsir/pip-fc/issues)。
## 许可
该项目采用 MIT 许可证,详情请见 [LICENSE](LICENSE) 文件。