vnpy / vnpy_ctp

VeighNa框架的CTP交易接口
https://www.vnpy.com
MIT License
118 stars 106 forks source link

macos: symbol not found in flat namespace '_libiconv' #54

Closed zevichen closed 6 months ago

zevichen commented 6 months ago

咨询下我这个是什么问题:

整体操作步骤:

  1. clone仓库
  2. 创建.venv
  3. 安装vnpy
  4. pip install -e . 安装
  5. 运行run.py报错
/Users/xx/work/quant/vnpy_ctp/.venv/bin/python /Users/xx/work/quant/vnpy_ctp/script/run.py 
Traceback (most recent call last):
  File "/Users/xx/work/quant/vnpy_ctp/script/run.py", line 5, in <module>
    from vnpy_ctp import CtpGateway
  File "/Users/xx/work/quant/vnpy_ctp/vnpy_ctp/__init__.py", line 26, in <module>
    from .gateway import CtpGateway
  File "/Users/xx/work/quant/vnpy_ctp/vnpy_ctp/gateway/__init__.py", line 1, in <module>
    from .ctp_gateway import CtpGateway
  File "/Users/xx/work/quant/vnpy_ctp/vnpy_ctp/gateway/ctp_gateway.py", line 31, in <module>
    from ..api import (
  File "/Users/xx/work/quant/vnpy_ctp/vnpy_ctp/api/__init__.py", line 1, in <module>
    from .vnctpmd import MdApi
ImportError: dlopen(/Users/xx/work/quant/vnpy_ctp/vnpy_ctp/api/vnctpmd.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_libiconv'
vnpy commented 6 months ago

删除clone目录的dist/build/egg-info三个文件夹。

然后运行python setup.py build。

看看有没有报错?

zevichen commented 6 months ago

解决方法:~/.zshrc中添加动态库地址。

export DYLD_LIBRARY_PATH=/opt/homebrew/opt/libiconv/lib:/opt/homebrew/anaconda3/lib:$DYLD_LIBRARY_PATH

vnpy commented 6 months ago

感谢反馈