7

python代码报错No module named numpy问题

 1 year ago
source link: https://blog.51cto.com/u_14682436/5882590
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

python代码报错No module named numpy问题

精选 原创

1 一般在“控制面板+cmd”中安装​ ​numpy​

在​ ​命令行​​窗口中输入"pip install numpy"

此时安装的numpy并不在python的目录行中

则会出现No module named numpy报错,即使是在python程序开头导入"import numpy as numpy"

2 解决办法:

(1)是直接在dos窗口找到python安装位置直接输入"pip install numpy"语句

此时输入回车等待安装即可

(2)是安装后强制重新下载最新版本

在dos窗口找到python安装位置输入"pip install numpy --ignore-installed numpy"语句

则会强制重装在新的位置,此时就是将numpy包安装到python中

需注意后面这个语句是在win系统输入的

要在linux的系统应该是要在前面加多"sudo"字段

即:“sudo pip install numpy --ignore-installed numpy”

  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK