cygwin下,python pip等包安装相关笔记

本文介绍了在Cygwin中安装Python及其包管理器pip的方法,包括如何利用国内镜像源加速下载,并提供了修改pip配置以永久使用镜像源的步骤。此外,还提到了使用easy_install进行包安装的技巧。

总所周知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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值