【Python系列】之python2.7.6离线安装Matplotlib

1、离线安装pip

(1)在python的安装目录下,新建packages文件夹,例:C:\Python27\packages

(2)https://pip.pypa.io/en/stable/installing/ 下载get-pip.py

(3)Unofficial Windows Binaries for Python Extension Packages 下载pip-8.1.2-py2.py3-none-any.whl和wheel-0.29.0-py2.py3-none-any.whl

python get-pip.py --no-index --no-setuptools --find-links=.\packages

get-pip.py options
–no-setuptools
If set, don’t attempt to install setuptools
–no-wheel
If set, don’t attempt to install wheel

2、查看pip 支持的whl类型
pip debug --verbose
https://blog.csdn.net/qq_38161040/article/details/103881372

AMD64

import pip._internal
print(pip._internal.pep425tags.get_supported())

WIN32

import pip
print(pip.pep425tags.get_supported())

在这里插入图片描述
在这里插入图片描述

3、安装Matplotlib

如果是whl包,安装方法如:

pip install wheel-0.29......whl

如果下载的不是whl包,在windows下解压的包里有setup.py,则安装方法为:
先到解压包的目录,如
在这里插入图片描述
然后使用命令:

python setup.py install

(1)需要提前安装:https://pypi.python.org/pypi/six

(2)需要提前安装:https://pypi.python.org/pypi/numpy

 依次用pip安装: pyparsing ; pytz; setuptools; six; cycler; pytz; python-deteutil; matplotlib;

特别说明:matplotlib的各种依赖包可参考:https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

matplotlib的各种依赖库在:https://www.lfd.uci.edu/~gohlke/pythonlibs/ 下载,注意:下载的whl类型要和【2、查看Pip支持的whl类型】一致,否则会出现:
Installing numpy from wheel format: “…is not a supported wheel on this platform”

安装的时候出现的警告

Could not fetch URL https://pypi.python.org/simple/fastnumbers/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.python.org’, port=443): Max retries exceeded with url: /simple/fastnumbers/ (C
aused by SSLError(SSLError(1, ‘_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version’),)) - skipping
Could not find a version that satisfies the requirement fastnumbers (from versions: )
No matching distribution found for fastnumbers

https://superuser.com/questions/1336153/pip-cannot-fetch-url-because-of-an-error-with-the-ssl-certificate 介绍是由于python 2.7.6 SSL协议比较老导致的,python 2.7.15就没这问题。不过如果是whl包的形式,目测对安装过程无影响。

4、验证是否安装成功
# plot a sine wave from 0 to 4pi
from pylab import *
x_values = arange(0.0, math.pi * 4, 0.01)
y_values = sin(x_values)
plot(x_values, y_values, linewidth=1.0)
xlabel('x')
ylabel('sin(x)')
title('Simple plot')
grid(True)
savefig("sin.png")
show()

参考网址:http://www.voidcn.com/article/p-djcdtooa-rd.html

参考网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/

参考网址:https://segmentfault.com/a/1190000006027207

参考网址:http://blog.csdn.net/sinat_26933727/article/details/68953193

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值