[英]Trying to import numpy but VSCode gives me pylint(import-error)?
I used command prompt to install numpy by using the following commands我使用命令提示符通过使用以下命令来安装 numpy
pip3 install numpy
and和
python.exe -m install numpy
and it's installed it in my appdata\\local\\packages\\pythonsoftwarefoundation etc folder.并将其安装在我的 appdata\\local\\packages\\pythonsoftwarefoundation 等文件夹中。
However when trying to import numpy in my python fil in VSCode it gives me "Unable to import 'numpy' pylint(import-error)"但是,当尝试在 VSCode 中的 python fil 中导入 numpy 时,它给了我“无法导入 'numpy' pylint(import-error)”
Not sure what the deal is.不知道是什么交易。 I've imported other libraries before like discord.py in the same way and it's worked for me.
我之前以同样的方式导入了其他库,例如 discord.py,它对我有用。 Any help is appreciated.
任何帮助表示赞赏。
After installing numpy
, use pip show numpy
to check if it was installed in current environment:安装
numpy
,使用pip show numpy
检查它是否安装在当前环境中:
Then press the green button on the upper right corner, run the file in Terminal.然后按右上角的绿色按钮,在终端中运行该文件。
The module py
usage is:模块
py
用法为:
So the right command is py test.py -3
, also it's recommended that use the command python
to run .py file.所以正确的命令是
py test.py -3
,也推荐使用命令python
来运行 .py 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.