# python-study **Repository Path**: fun-study/python-study ## Basic Information - **Project Name**: python-study - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-09-02 - **Last Updated**: 2025-07-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 在使用 `pip` 安装 Python 包时,可以通过指定国内镜像源来加速下载。以下是一些常用的国内镜像源及其使用方法: ### 常用国内镜像源 - **清华大学**: https://pypi.tuna.tsinghua.edu.cn/simple - **阿里云**: https://mirrors.aliyun.com/pypi/simple - **豆瓣**: https://pypi.douban.com/simple - **中国科学技术大学**: https://pypi.mirrors.ustc.edu.cn/simple ### 临时使用镜像源 你可以在 `pip install` 命令后加上 `-i` 参数来临时使用某个镜像源。例如: ```bash pip install 包名 -i https://pypi.tuna.tsinghua.edu.cn/simple ``` ### 永久配置镜像源 如果你希望永久使用某个镜像源,可以通过修改 `pip` 的配置文件来实现。 #### 方法一:使用命令行配置 在命令行中运行以下命令: ```bash pip config set global.index-url https://mirrors.aliyun.com/pypi/simple ``` #### 方法二:手动编辑配置文件 1. 找到 `pip` 的配置文件,通常位于以下路径: - Linux/macOS: `~/.pip/pip.conf` - Windows: `%APPDATA%\pip\pip.ini` 2. 如果文件不存在,可以手动创建。 3. 在配置文件中添加以下内容: ```ini [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple ``` ### 验证配置 你可以通过以下命令验证配置是否生效: ```bash pip config list ``` 如果看到 `global.index-url` 已经设置为指定的镜像源,说明配置成功。 ### 其他注意事项 - 如果你使用的是虚拟环境(如 `venv` 或 `conda`),配置文件的路径可能会有所不同。 - 某些镜像源可能会有同步延迟,如果遇到问题可以尝试切换到其他镜像源。 希望这些信息对你有帮助!