Python Pip无法安装matplotlib

Python Pip无法安装matplotlib,python,matplotlib,ubuntu,pip,Python,Matplotlib,Ubuntu,Pip,由于旧版本的一些问题,我不得不重新下载Python和PyCharm,现在正在为我的项目重新安装一些软件包。numpy和pandas使用PyCharm软件包管理器界面安装得很好,但当我尝试安装matplotlib时,只收到一条错误消息 错误:命令出错,退出状态为1: 当我查找更多信息时,PyCharm建议我“尝试从系统终端运行pip install matplotlib。确保为位于[我的路径]的Python解释器安装了正确版本的'pip'。当我尝试在终端中运行该命令时,我收到以下消息: DEPRE

由于旧版本的一些问题,我不得不重新下载Python和PyCharm,现在正在为我的项目重新安装一些软件包。numpy和pandas使用PyCharm软件包管理器界面安装得很好,但当我尝试安装matplotlib时,只收到一条错误消息

错误:命令出错,退出状态为1:

当我查找更多信息时,PyCharm建议我“尝试从系统终端运行
pip install matplotlib
。确保为位于[我的路径]的Python解释器安装了正确版本的'pip'。当我尝试在终端中运行该命令时,我收到以下消息:

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
  Using cached matplotlib-2.2.5-cp27-cp27mu-manylinux1_x86_64.whl (12.8 MB)
Collecting python-dateutil>=2.1
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.1.0-cp27-cp27mu-manylinux1_x86_64.whl (93 kB)
Collecting numpy>=1.7.1
  Using cached numpy-1.16.6-cp27-cp27mu-manylinux1_x86_64.whl (17.0 MB)
Collecting six>=1.10
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting cycler>=0.10
  Using cached cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting pytz
  Using cached pytz-2020.4-py2.py3-none-any.whl (509 kB)
Collecting backports.functools-lru-cache
  Using cached backports.functools_lru_cache-1.6.1-py2.py3-none-any.whl (5.7 kB)
Collecting subprocess32
  Using cached subprocess32-3.5.4-cp27-cp27mu-manylinux2014_x86_64.whl (69 kB)
Requirement already satisfied: setuptools in /home/[myusername]/.local/lib/python2.7/site-packages (from kiwisolver>=1.0.1->matplotlib) (44.1.1)
Installing collected packages: six, python-dateutil, kiwisolver, numpy, cycler, pyparsing, pytz, backports.functools-lru-cache, subprocess32, matplotlib
Successfully installed backports.functools-lru-cache-1.6.1 cycler-0.10.0 kiwisolver-1.1.0 matplotlib-2.2.5 numpy-1.16.6 pyparsing-2.4.7 python-dateutil-2.8.1 pytz-2020.4 six-1.15.0 subprocess32-3.5.4
我使用的是windows,但安装了Ubuntu,我曾尝试运行该命令,因为当我尝试在git bash上使用pip执行任何操作时,我得到了
bash:/c/Users/[myusername]/AppData/Local/Microsoft/WindowsApps/python:权限被拒绝


无论如何,我想问题是我安装了Python2.7(Python——版本同意),它不会与matplotlib合作。因此,我使用Ubuntu终端进入/home/[myusername]/.local/lib/python2.7/site-packages,并使用
rm-r python2.7
删除文件夹。由于我在
C:\Users\[myusername]\AppData\Local\Programs\Python\Python39\Python.exe安装了Python 3.9,因此我假设这只是默认的较新版本。然而,当我重新启动所有程序时,Python2.7会再次出现在它原来的位置,并且该版本会继续运行。我相信这与我如何使用Ubuntu有关,因为Python 2.7只存在于我的C:驱动器之外。但是,我不知道如何从这里开始安装matplotlib。非常感谢您的帮助

我想这是一个网络发布的帮助?这是一个路径问题。安装Python2.7时,很可能会将主Python脚本的文件路径添加到操作系统的PATH变量中。在ubuntu上,您可以打开一个终端并键入'echo$PATH'来查看PATH变量,并在其中找到旧的Python 2.7文件路径。您应该能够将该行更改为Python3.9主Python脚本的路径,然后pip就可以工作了。