无法为python 3 Mac OSX El Capitan安装MatPlotLib

时间:2018-08-16 08:18:11

标签: python python-3.x matplotlib

我对编码非常陌生,不了解安装过程。我在Max OSX El Capitan上使用Python 3.7.0。我想安装matplotlib,但我在终端中尝试了此方法:

$ pip install matplotlib 

它给了我一个错误:

192-168-1-107:~ Ada1$ pip install matplotlib Requirement already satisfied: matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python 
Requirement already satisfied: numpy>=1.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)  
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)     
Collecting tornado (from matplotlib) Could not fetch URL https://pypi.python.org/simple/tornado/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping Could not find a version that satisfies the requirement tornado (from matplotlib) (from versions: ) No matching distribution found for tornado (from matplotlib)

我也尝试过:

  

$ sudo pip install matplotlib

但存在相同的错误,而python给出了未安装的错误。帮助吗?

1 个答案:

答案 0 :(得分:0)

基本上可以看到3种可能的原因:

  • 与python 3或2版本冲突(大多数情况)
  • 特定于OSX的错误(需要使用更新的pip版本,如here所述),
  • 您落后于firewal(可以通过在pip命令中添加标志来禁用SSL)

要确保要安装到python 3,可以使用:

pip3 install -U matplotlib

虚拟环境以及pipenv,conda和可能的poetry是您的朋友,将来可以更好地隔离python项目设置。