openctp / openctp-ctp-python

CTPAPI的Python接口,使用Swig技术制作,支持pip install。
http://www.openctp.cn
BSD 3-Clause "New" or "Revised" License
122 stars 23 forks source link

容器运行时报错 #4

Closed congcong009 closed 1 year ago

congcong009 commented 1 year ago

我用docker容器运行一个python 3.8.16-slim-buster环境,执行以下命令时

from openctp_ctp.thostmduserapi import CThostFtdcDepthMarketDataField, CThostFtdcMdSpi

出现报错,如下:

terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted (core dumped)

我另外尝试了以下方式,也会有问题

from openctp_ctp.thostmduserapi import CThostFtdcMdApi

请问怎么解决呢?

Jedore commented 1 year ago

看readme常见问题里有答案

congcong009 commented 1 year ago

解决,在 Dockerfile 中脚本如下:

RUN apt update && apt install -y locales && echo "Y" | localedef -c -f GB18030 -i zh_CN zh_CN.GB18030