我面临以下错误:
import numpy
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import numpy
File "C:UserssaikrPython38libsite-packagesnumpy__init__.py", line 140, in <module>
from . import _distributor_init
File "C:UserssaikrPython38libsite-packagesnumpy_distributor_init.py", line 22, in <module>
for filename in glob.glob(os.path.join(libs_dir,
AttributeError: module 'glob' has no attribute 'glob'
在IDE 中发生此错误
C:\Users\saikr>numpy
'numpy' is not recognized as an internal or external command,
operable program or batch file.
此错误发生在 CMD 中
如何解决?
试试这个: 类型python
在 CMD 中 然后键入import numpy as np
您的 IDE 很可能会为您启动的每个新项目创建一个虚拟环境(有关 venv 的更多详细信息,链接到 pep 405(。 您可以使用 IDE 中的pip freeze
来查看当前环境中所有已安装的软件包
发生第二个错误是因为您正在从 cmd 调用 python 命令。您需要在代码之前调用python
命令才能从cmd运行python命令