总所周知fkggffww的存在,下个东西都不行。
保证安装cygwin时已经安装了python或者在安装完apt-cyg之后用它下载python也可以。
国内镜像源
阿里云
https://mirrors.aliyun.com/pypi/simple/
豆瓣(douban)
https://pypi.douban.com/simple/
清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学
https://pypi.mirrors.ustc.edu.cn/simple/
临时使用
在使用pip的时候加参数 -i http://mirrors.aliyun.com/pypi/simple/
例如:pip install -i http://mirrors.aliyun.com/pypi/simple/ pyspider,这样就会从阿里云这边的镜像去安装pyspider库。
一劳永逸
类似Linux下,cygwin下修改 ~/.pip/pip.conf (新建)
内容如下:
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
安装常用包:
pip:
使用easy_install + 国内源的方法:
$ easy_install-2.7 -i http://mirrors.aliyun.com/pypi/simple/ pip
Searching for pip
Reading http://mirrors.aliyun.com/pypi/simple/pip/
Downloading http://mirrors.aliyun.com/pypi/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl#sha256=5244e51494f5d1dfbb89da492d4250cb07f9246644736d10ed6c45deb1a48500
Best match: pip 20.2.2
Processing pip-20.2.2-py2.py3-none-any.whl
Installing pip-20.2.2-py2.py3-none-any.whl to /usr/lib/python2.7/site-packages
Adding pip 20.2.2 to easy-install.pth file
Installing pip script to /usr/bin
Installing pip3.8 script to /usr/bin
Installing pip3 script to /usr/bin
Installed /usr/lib/python2.7/site-packages/pip-20.2.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
其实我就是想拉一下网页数据:
cat get_jsl.py
#!/usr/bin/env python
# coding=utf-8
import requests
res = requests.get('https://www.jisilu.cn/data/convert_bond_detail/128092')
res.encoding = 'utf-8'
print(res.text)
本文介绍了在Cygwin中安装Python及其包管理器pip的方法,包括如何利用国内镜像源加速下载,并提供了修改pip配置以永久使用镜像源的步骤。此外,还提到了使用easy_install进行包安装的技巧。
1087

被折叠的 条评论
为什么被折叠?



