efinance
efinance copied to clipboard
多股票获取报错
Processing => 300355: 1%|▏ | 69/4714 [00:15<13:53, 5.57it/s]Traceback (most recent call last):
File "/Users/zhanghui/Documents/Program/实时获取行情efinance-main/test.py", line 35, in
这个是不是我电脑不行,所以停止了多线程?
限制一下线程数量吧。代码如下
import multitasking
multitasking.set_max_threads(8)
把上面的代码放在前面,然后再获取数据。
multitasking.set_max_threads(2) st = ef.stock.get_quote_history(code) 这样吗? 我这样写还是出现 RuntimeError: can't start new thread
multitasking.set_max_threads(2)
st = ef.stock.get_quote_history(code)
这样吗?
我这样写还是出现 RuntimeError: can't start new thread
对,是这样子写。你再试一下,把代码写到 .py 文件里面再运行 .py 文件。
不行,还是这个错误
不行,还是这个错误
那暂时没有办法了,我没有 mac 来测试。你先用单线程的吧,每次传一只股票代码。或者也可以自己想想怎么加多线程。
好的,谢谢
还真是Mac和win的系统问题。用win完全没问题