国内镜像源推荐
以下是几个推荐的国内Python包镜像源:
- 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple
- 阿里云:http://mirrors.aliyun.com/pypi/simple/
- 中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/
- 华中科技大学:http://pypi.hustunique.com/
- 山东理工大学:http://pypi.sdutlinux.org/
- 豆瓣:http://pypi.douban.com/simple
镜像源配置方法
使用pip命令配置
要使用特定的镜像源安装包,可以使用以下格式的命令:
pip install 库名 -i 镜像地址
例如,安装pandas库:
pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple
永久添加镜像的方法
要永久设置镜像源,可以使用以下命令:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
或
pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn
PyCharm内部配置方法
在PyCharm中配置镜像源,可以按照以下步骤操作:
打开PyCharm设置。
导航到“Project: [项目名]” > “Python Interpreter”。
在“Package Index”部分,输入镜像地址。