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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/listener51/article/details/85535687

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-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类型

AMD64

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

WIN32

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

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

3、安装Matplotlib

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

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

特别说明: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

猜你喜欢

转载自blog.csdn.net/listener51/article/details/85535687