【问题标题】:Python file opens then immediately closes [closed]Python文件打开然后立即关闭[关闭]
【发布时间】:2020-08-01 00:54:22
【问题描述】:

所以我正在尝试下载适用于 python 的 Interactive Brokers API。我已经按照网站的说明下载了api,然后我去了source,python客户端,然后当我打开setup python文件时,文件会打开一个小黑屏然后立即关闭。我正在使用python 3.8。任何人对为什么会发生这种情况有任何想法(我在下面添加了我现在收到的错误)?谢谢

编辑: 当我在命令提示符中输入“C:\TWS API\source\pythonclient”,然后 python setup.py install,我得到错误:

running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.2288.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-13760.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2288.0_x64__qbz5n2kfra8p0\Lib\site-packages\

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.

【问题讨论】:

  • 你是如何运行这个文件的?您是否在 Windows 上并单击它运行?如果您打开命令提示符并在那里运行它,您可能会看到更好的信息。
  • 我尝试通过命令提示符运行它并单击它。我试图通过 CMD 运行它,说“python setup.py install”,它说文件python: can't open file 'setup.py': [Errno 2] No such file or directory
  • 这对@FishingCode 没有帮助
  • 可能会在问题中添加更多详细信息/回溯本身。这个问题很模糊。

标签: python api python-3.8 interactive-brokers


【解决方案1】:

你必须进入cmd并进入你存储API文件的目录然后输入python setup.py install这是假设你已经安装了python。使用 cd 导航到文件位置。

【讨论】:

  • cd.. 两次移回 C:\> 然后 cd "TWS API" (建议在命名文件时使用下划线,这样您就不必使用引号)然后 cd sources 等。让我知道这是否有帮助
  • 在您的 cmd 终端中输入 cd "C:\TWS API\source\pythonclient"。如果那是您安装 API 文件的目录,那里应该有一个 setup.py。一旦终端位于应启动设置的目录类型python setup.py install
  • 右键点击 cmd 并点击“以管理员身份运行”然后重试(upvoting my cmets and answer可以帮助我获得互联网积分)
  • 尝试python setup.py install --user(添加--user)
  • lmfao 没问题的人谢谢你,不客气
猜你喜欢
  • 2017-11-21
  • 2016-03-19
  • 1970-01-01
  • 1970-01-01
  • 2018-11-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-20
相关资源
最近更新 更多