没换源建议先换个源
国内源:
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
暂时换源方法:例子中选择的源为豆瓣源
共存时对python2安装从numpy库
python2 -m pip install numpy -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
无共存时
python -m pip install numpy -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
或
pip install numpy -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
永久换源方法:
在windows自带文件管理器地址栏输入 %appdata% 再回车
若无 pip 这个文件夹则新建,在 pip 文件夹里新建一个名为 pip.ini 的配置文件,用记事本编辑配置文件,内容为(例子中所用的源为豆瓣源):
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host = pypi.douban.com
保存即可
共存时对python2安装numpy库
python2 -m pip install numpy
无共存时
python -m pip install numpy
或
pip install numpy
成功换源例子: