如果你用:
pip install pygame
下载很慢,可以使用国内镜像:
pip install pygame -i https://pypi.mirrors.ustc.edu.cn/simple/
常用国内镜像有:
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
下载的时候可以看到:
C:\Users\Administrator>pip install pygame -i https://pypi.tuna.tsinghua.edu.cn/simple/
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting pygame
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d2/55/ca3eb851aeef4f6f2e98a360c201f0d00bd1ba2eb98e2c7850d80aabc526/pygame-2.6.1-cp311-cp311-win_amd64.whl (10.6 MB)
---------------------------------------- 10.6/10.6 MB 2.1 MB/s eta 0:00:00
Installing collected packages: pygame
Successfully installed pygame-2.6.1
[notice] A new release of pip is available: 23.1.2 -> 25.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip
所以,我们可以打开地址:
<strong>C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages</strong>
通过测试,发现它新建了文件夹pygame和pygame-2.6.1.dist-info忙着就是库。
如果再次用pip下载,会提示已经下载了:
C:\Users\Administrator>pip install pygame -i https://pypi.tuna.tsinghua.edu.cn/simple/
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Requirement already satisfied: pygame in c:\users\administrator\appdata\local\programs\python\python311\lib\site-packages (2.6.1)
[notice] A new release of pip is available: 23.1.2 -> 25.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip