python - Matplotlib 仍未安装在 v3.8.6 的 python 上。(之前我在 v3.9 上)
问题描述
有人告诉我 matplotlib 的轮子不适用于 python v3.9,所以我应该尝试安装 v3.8.6。所以我卸载了python并将它重新安装到那个版本,但是当我跑的时候
sudo easy_install pip
输出是:
Searching for pip
Reading https://pypi.org/simple/pip/
Downloading https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl#sha256=51f1c7514530bd5c145d8f13ed936ad6b8bfcb8cf74e10403d0890bc986f0033
Best match: pip 20.2.4
Processing pip-20.2.4-py2.py3-none-any.whl
Installing pip-20.2.4-py2.py3-none-any.whl to /Library/Python/2.7/site-packages
Adding pip 20.2.4 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3.8 script to /usr/local/bin
Installing pip3 script to /usr/local/bin
Installed /Library/Python/2.7/site-packages/pip-20.2.4-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
所以我认为 pip 已安装,然后我运行:
python -m pip install -U matplotlib
并得到这个输出:
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.
Defaulting to user installation because normal site-packages is not writeable
Collecting matplotlib
Downloading matplotlib-2.2.5-cp27-cp27m-macosx_10_9_x86_64.whl (12.9 MB)
|████████████████████████████████| 12.9 MB 5.2 MB/s
Requirement already satisfied, skipping upgrade: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (2.0.1)
Collecting backports.functools-lru-cache
Downloading backports.functools_lru_cache-1.6.1-py2.py3-none-any.whl (5.7 kB)
Requirement already satisfied, skipping upgrade: pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (2013.7)
Requirement already satisfied, skipping upgrade: six>=1.10 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (1.12.0)
Collecting python-dateutil>=2.1
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
|████████████████████████████████| 227 kB 17.3 MB/s
Collecting cycler>=0.10
Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Requirement already satisfied, skipping upgrade: numpy>=1.7.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (1.8.0rc1)
Collecting kiwisolver>=1.0.1
Downloading kiwisolver-1.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (115 kB)
|████████████████████████████████| 115 kB 19.0 MB/s
Collecting subprocess32
Downloading subprocess32-3.5.4-cp27-cp27m-macosx_10_6_intel.whl (34 kB)
Requirement already satisfied, skipping upgrade: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from kiwisolver>=1.0.1->matplotlib) (41.0.1)
Installing collected packages: backports.functools-lru-cache, python-dateutil, cycler, kiwisolver, subprocess32, matplotlib
Successfully installed backports.functools-lru-cache-1.6.1 cycler-0.10.0 kiwisolver-1.1.0 matplotlib-2.2.5 python-dateutil-2.8.1 subprocess32-3.5.4
所以我假设 matplotlib 已成功安装并在 IDLE 中运行此测试代码:
#Importing pyplot
from matplotlib import pyplot as plt
#Plotting to our canvas
plt.plot([1,2,3],[4,5,1])
#Showing what we plotted
plt.show()
我再次收到错误消息:
Traceback (most recent call last):
File "/Users/Jai/Desktop/Python Programs/Test 1.py", line 2, in <module>
from matplotlib import pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
有人可以帮忙吗?我在 MacOS 10.15.7 谢谢。
解决方案
推荐阅读
- c++ - 在 ConsoleApplication2.exe 中的 0x00080000 处引发异常:0xC0000005:访问冲突执行位置 0x00080000 Visual Studio
- macos - 在 MacOS 上使用 Cmd+tab 激活 Electron 应用程序
- java - 在 Repl.it 上进行“扑克脸”练习的测试失败
- javascript - React - 结合即时输入和去抖动输出
- python - 使用 Qt Gui 执行慢速实时视频源的 Opencv 人脸检测
- postgresql - 将现有 shapefile 从地理服务器上传到 postgresql
- c# - C# 无法将列表转换为 IEnumerable
- django - 如何在 django admin 中嵌套类别
- export-to-csv - 如何将大量数字从 HeidiSQL 导出到 csv
- python - Python while循环不会增加变量