首页 > 解决方案 > 在 python (Mac) 上安装模块时遇到问题

问题描述

我对使用 pip 在 Python 上安装模块有点陌生。我相信我已经安装了 pip,但是当我尝试使用我尝试使用 pip 安装的模块时,它说没有这样的模块。我将发布终端响应以查看发生了什么。如果有人可以让我知道我是否在安装模块时出错,我将非常感激,感谢您的宝贵时间。

faizrahman@138-38-186-80 ~ % sudo pip install matplotlib
Password:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
WARNING: The directory '/Users/faizrahman/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (1.3.1)
Requirement already satisfied: numpy>=1.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (1.8.0rc1)
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (1.5)
Requirement already satisfied: tornado in /Library/Python/2.7/site-packages (from matplotlib) (5.1.1)
Requirement already satisfied: pyparsing>=1.5.6 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (2.0.1)
Requirement already satisfied: nose in /Library/Python/2.7/site-packages (from matplotlib) (1.3.7)
Requirement already satisfied: singledispatch in /Library/Python/2.7/site-packages (from tornado->matplotlib) (3.4.0.3)
Requirement already satisfied: futures in /Library/Python/2.7/site-packages (from tornado->matplotlib) (3.3.0)
Requirement already satisfied: backports-abc>=0.4 in /Library/Python/2.7/site-packages (from tornado->matplotlib) (0.5)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado->matplotlib) (1.12.0)
faizrahman@138-38-186-80 ~ % 


标签: pythonmacosmodulepip

解决方案


您需要从 python3 调用 pip: sudo python3 -m pip install matplotlib


推荐阅读