python库安装错误 in _error_catcher解决之镜像安装(转)非常好用

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python库安装错误 in _error_catcher解决之镜像安装(转)非常好用相关的知识,希望对你有一定的参考价值。

参考技术A pip install grpcio-tools

1、出现如下错误:

Traceback (most recent call last):

File "d:\usedtool\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 302, in _error_catcher

yield

File "d:\usedtool\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 384, in read

data = self._fp.read(amt)

File "d:\usedtool\python\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read

data = self.__fp.read(amt)

File "d:\usedtool\python\lib\http\client.py", line 449, in read

n = self.readinto(b)

File "d:\usedtool\python\lib\http\client.py", line 493, in readinto

n = self.fp.readinto(b)

File "d:\usedtool\python\lib\socket.py", line 586, in readinto

return self._sock.recv_into(b)

File "d:\usedtool\python\lib\ssl.py", line 1009, in recv_into

return self.read(nbytes, buffer)

File "d:\usedtool\python\lib\ssl.py", line 871, in read

return self._sslobj.read(len, buffer)

File "d:\usedtool\python\lib\ssl.py", line 631, in read

v = self._sslobj.read(len, buffer)

socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "d:\usedtool\python\lib\site-packages\pip\_internal\basecommand.py", line 228, in main

status = self.run(options, args)

File "d:\usedtool\python\lib\site-packages\pip\_internal\commands\install.py", line 291, in run

resolver.resolve(requirement_set)

File "d:\usedtool\python\lib\site-packages\pip\_internal\resolve.py", line 103, in resolve

self._resolve_one(requirement_set, req)

File "d:\usedtool\python\lib\site-packages\pip\_internal\resolve.py", line 257, in _resolve_one

abstract_dist = self._get_abstract_dist_for(req_to_install)

File "d:\usedtool\python\lib\site-packages\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for

self.require_hashes

File "d:\usedtool\python\lib\site-packages\pip\_internal\operations\prepare.py", line 310, in prepare_linked_requirement

progress_bar=self.progress_bar

File "d:\usedtool\python\lib\site-packages\pip\_internal\download.py", line 837, in unpack_url

progress_bar=progress_bar

File "d:\usedtool\python\lib\site-packages\pip\_internal\download.py", line 674, in unpack_http_url

progress_bar)

File "d:\usedtool\python\lib\site-packages\pip\_internal\download.py", line 898, in _download_http_url

_download_url(resp, link, content_file, hashes, progress_bar)

File "d:\usedtool\python\lib\site-packages\pip\_internal\download.py", line 618, in _download_url

hashes.check_against_chunks(downloaded_chunks)

File "d:\usedtool\python\lib\site-packages\pip\_internal\utils\hashes.py", line 48, in check_against_chunks

for chunk in chunks:

File "d:\usedtool\python\lib\site-packages\pip\_internal\download.py", line 586, in written_chunks

for chunk in chunks:

File "d:\usedtool\python\lib\site-packages\pip\_internal\utils\ui.py", line 159, in iter

for x in it:

File "d:\usedtool\python\lib\site-packages\pip\_internal\download.py", line 575, in resp_read

decode_content=False):

File "d:\usedtool\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 436, in stream

data = self.read(amt=amt, decode_content=decode_content)

File "d:\usedtool\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 401, in read

raise IncompleteRead(self._fp_bytes_read, self.length_remaining)

File "d:\usedtool\python\lib\contextlib.py", line 99, in __exit__

self.gen.throw(type, value, traceback)

File "d:\usedtool\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 307, in _error_catcher

raise ReadTimeoutError(self._pool, None, 'Read timed out.')

pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

解决方案:pip install grpcio-tools -i https://pypi.doubanio.com/simple

后面的-i https://pypi.doubanio.com/simple即是镜像

---------------------

原文:https://blog.csdn.net/weixin_38383877/article/details/81101335 ( 侵删,感谢! )

python_库学习_01

一。python的库学习

财经数据接口包

1.安装ThShare 直接pip install tushare

可能会出现缺少依赖库的情况,依次安装,大概有lxml,pandas,bs4,requests,pandas依次安装后查看tushare官方文档详细接口的使用

  1. 查看是否安装成功查询版本号,

 

import tushare as ts

print ts.__version__,

3.ps 此库并不是在pythoncharm中运行,atom中或者cmd可以输出需要的数据

 

4..说明尝试

技术分享图片

import tushare as ts

df = ts.get_hist_data(‘600848‘)

ts.get_hist_data(‘600848‘ktype=‘W‘) #获取周k线数据

ts.get_hist_data(‘600848‘ktype=‘M‘) #获取月k线数据

ts.get_hist_data(‘600848‘ktype=‘5‘) #获取5分钟k线数据

ts.get_hist_data(‘600848‘ktype=‘15‘) #获取15分钟k线数据

ts.get_hist_data(‘600848‘ktype=‘30‘) #获取30分钟k线数据

ts.get_hist_data(‘600848‘ktype=‘60‘) #获取60分钟k线数据

ts.get_hist_data(‘sh‘#获取上证指数k线数据,其它参数与个股一致,下同

ts.get_hist_data(‘sz‘#获取深圳成指k线数据 ts.get_hist_data(‘hs300‘#获取沪深300指数k线数据

ts.get_hist_data(‘sz50‘#获取上证50指数k线数据

ts.get_hist_data(‘zxb‘#获取中小板指数k线数据

ts.get_hist_data(‘cyb‘#获取创业板指数k线数据

Python财经数据接口包TuShare的使用

获取历史分笔数据

df = ts.get_tick_data(‘000756‘,‘2015-03-27‘)

df.head(10)

4.

获取实时分笔数据:

返回值说明:

0name,股票名字

1open,今日开盘价

2pre_close,昨日收盘价

3price,当前价格

4high,今日最高价

5low,今日最低价

6bid,竞买价,即“买一”报价

7ask,竞卖价,即“卖一”报价

8volumn,成交量 maybe you need do volumn/100

9amount,成交金额(元 CNY

10b1_v,委买一(笔数 bid volume

11b1_p,委买一(价格 bid price

12b2_v,“买二”

13b2_p,“买二”

14b3_v,“买三”

15b3_p,“买三”

16b4_v,“买四”

17b4_p,“买四”

18b5_v,“买五”

19b5_p,“买五”

20a1_v,委卖一(笔数 ask volume

21a1_p,委卖一(价格 ask price

...

30date,日期

31time,时间

 

以上是关于python库安装错误 in _error_catcher解决之镜像安装(转)非常好用的主要内容,如果未能解决你的问题,请参考以下文章

python 安装surprise库解决 c++tools错误问题

pip install 安装第三方库报错

安装第三方库 报错Python version 2.7 required, which was not found in the registry

python运行时报错can't find '__main__' module in 'xxx' 的解决办法

安装第三方库出现 Python version 2.7 required, which was not found in the registry

python unittest 执行结果Ran 0 tests in 0.000s问题解决