我使用的是Visual Studio Code Version 1.19.3和python3,我有两种情况,其中python不会从特定的库中导入模块。
第一种是导入烧瓶模块,例如:
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField,
SubmitField
from wtforms.validators import DataRequired
无法导入任何上述模块
第二种情况是在尝试使用numpy数组时:
import numpy as np
height = [74, 74, 72, 75, 72, 73, 73, 75, 75]
np_height = np.array(height)
np_height_m = np_height * 0.0254
print(np_height_m)
AttributeError: module 'numpy' has no attribute 'array'
我已正确安装所有库并且是最新的,并且在使用IDLE而不是Visual Studio时,这两组代码都能正常工作。任何输入都非常感谢:)谢谢,詹姆斯。