numpy图书馆的问题

2024-05-19 22:25:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用python3,需要使用numpy库,但是在执行代码时,在导入库的行上会出现一个错误。你知道吗

错误是:ModuleNotFoundError: No module named 'numpy'

我已经检查过了,库安装正确

import numpy as np

input = np.array([1,7,5])
weight = np.array([0.8, 0.1, 0])

def sum(inp, weig):
    return inp.dot(weig)

sum = sum(input, weight)

def stepFunction(sum):
    if (sum >= 1):
        return 1
    return 0

result = stepFunction(sum)

Tags: 代码numpyinputreturndef错误nparray