jupyter notebook Anaconda3下安装numpy失败的解决方法

jupyter notebook Anaconda3下安装numpy失败的解决方法

前提 这周作业里要求使用 numpy 库进行操作

电脑 python 环境

Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32


1. 尝试直接pip安装

pip install numpy

* 报错:*Requirement already satisfied: numpy in c:\users\eric\anaconda3\lib\site-packages (1.18.1)

jupyter notebook Anaconda3下安装numpy失败的解决方法


2. 百度发现是自己没有指定安装位置,指定后尝试

pip install --target=C:\Users\Eric\anaconda3\Lib numpy

* 报错:*ERROR: Could not find a version that satisfies the requirement numpy (from versions: none) ERROR: No matching distribution found for
numpy

jupyter notebook Anaconda3下安装numpy失败的解决方法
百度发现,可能是因为网络问题,于是更换为国内镜像豆瓣的源


3. 尝试指定位置并使用豆瓣源的方式安装

pip install --target=C:\Users\Eric\anaconda3\Lib numpy -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
jupyter notebook Anaconda3下安装numpy失败的解决方法
成功


bingo!
题外话:第一次使用 M↓写博客,感觉比在 typora 上面记笔记要舒服一点,csdn 上有图床很舒服

*补充pip环境变量的配置

在尝试 pip 安装之前发现自己的 pip 使用不了,猜想是环境变量的问题,百度了一下解决,需要在系统环境变量下配置目录

报错:‘pip’ 不是内部或外部命令,也不是可运行的程序 或批处理文件。

我的Anaconda3安装路径是在 C:\Users\Eric\anaconda3
jupyter notebook Anaconda3下安装numpy失败的解决方法
然后打开环境变量此电脑右键 - > 属性 - > 高级系统设置 - > 高级 - > 环境变量
然后双击系统变量里面的Path出现下图
jupyter notebook Anaconda3下安装numpy失败的解决方法
单击新建,然后将一下三个目录分别新建进去即刻,不用分号
C:\Users\Eric\anaconda3
C:\Users\Eric\anaconda3\Scripts
C:\Users\Eric\anaconda3\Library\bin