问题描述
我正在尝试简单地连接到 ibapi(Interactive Brokers API),但我在使用 Spyder 时遇到了一些技术问题.
I am trying to simply connect to the ibapi (Interactive Brokers API), but I am having some technical troubles with Spyder.
到目前为止我做了什么:
- 我从这里 安装了最新版本的 Windows
- 我为 Spyder 中的 PYTHONPATH 管理器提供了以下路径:
C:\TWS API\source\pythonclient\ibapi
之后我重新启动了 Spyder
- I installed the latest version for Windows from here
- I provided the following path to the PYTHONPATH manager in Spyder:
C:\TWS API\source\pythonclient\ibapi
afterwards I restarted Spyder
当我简单地输入 import ibapi
时,我得到同样的错误信息:ModuleNotFoundError: No module named 'ibapi'
When I simply type import ibapi
I get the same error message: ModuleNotFoundError: No module named 'ibapi'
我在这里做错了什么,我该如何解决这个简单的错误?
What I am doing wrong here and how can I fix this simple error?
推荐答案
我不太使用 python,但我很确定你必须安装 ibapi.我从未使用过 PYTHONPATH,我的在 Spyder 和 Jupyter 中工作正常.我正在使用 Anaconda.
I don't use python very much but I'm pretty sure you have to install the ibapi. I never used the PYTHONPATH and mine works fine in Spyder and Jupyter. I'm using Anaconda.
我运行 Anaconda 提示符(只是激活 conda 环境)并导航到目录 C:\TWS API\source\pythonclient
并运行 python setup.py install
I run the Anaconda prompt (just activates the conda environment) and navigate to the dir C:\TWS API\source\pythonclient
and run python setup.py install
然后一切正常.我觉得很多python包需要这样安装.
Then everything works. I think many python packages need to be installed like this.
注意:那不是我的安装目录,我只是复制了你的.路径中的空格可能有问题.如果仍有问题,请尝试重命名为 C:\TWSAPI\...
.
note: That's not my install dir, I just copied yours. There may be a problem with a space in the path. Try renaming to C:\TWSAPI\...
if you still have a problem.
这篇关于将 ibapi 库添加到 Spyder (Python 3.6) 中的 PYTHONPATH 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!