通过首先创建轮子来安装 python 模块

Install python module by first creating the wheel

我只是下载文件以在 python 中构建一个 API - 关于该 API 的简短教程建议为了将其安装为模块,必须执行以下操作:

* you can use this to build a wheel

python3 setup.py bdist_wheel

* you can use this to install the wheel

python3 -m pip install --user --upgrade dist/ibapi-9.73.1-py3-none-any.whl

这看起来很简单,但是我完全不熟悉 python 的那个方面并且有点不知所措...我尝试 运行 命令 python3 setup.py bdist_wheel 都在包含 API 的文件夹并首先输入 python 3 环境(通过键入 source activate python3 - 我正在使用 anaconda。return 错误 setup.py cannot be found.

任何人都知道这两个命令应该在哪里 运行 以便正确安装模块?

您应该为您的模块编写安装脚本

here

您可以按照以下步骤操作:

  1. cd C:\TWS API\source\pythonclient
  2. python setup.py bdist_wheel
  3. cd C:\Python36\Scripts
  4. python -m pip install --upgrade "C:\TWS API\source\pythonclient\dist\ibapi-9.73.2-py3-none-any.whl"

注意:将 python 和 API 版本更改为您正在使用的版本。