【问题标题】:ImportError when running Runpython Excel on Windows在 Windows 上运行 Runpython Excel 时出现 ImportError
【发布时间】:2018-02-08 09:05:46
【问题描述】:

我正在尝试学习使用 xlwings。我尝试从 excel 2016 运行 python 脚本,但它弹出错误消息。

错误信息: 回溯(最近一次通话最后): 文件“”,第 1 行,在 ImportError: 没有名为 hello 的模块

import numpy as np
import xlwings as xw

def world():
    wb = xw.Book.caller()
    wb.sheet[0].range('A1').value = "Hello World"

enter image description here

【问题讨论】:

  • 你的python文件是否命名为hello.py?

标签: python vba excel


【解决方案1】:

这就是你的全部代码吗? 如果是这样,可能的错误是您导入的模块缺少另一个模块或已更改,如果不是,您需要将名为“hello”的代码放入计算机上的内置 python 库中,因为它在错误的位置查找它.

【讨论】:

    猜你喜欢
    • 2014-05-07
    • 2019-01-05
    • 1970-01-01
    • 2016-09-26
    • 2020-04-10
    • 1970-01-01
    • 2023-01-16
    • 2018-12-23
    • 1970-01-01
    相关资源
    最近更新 更多