使用pip安装matplotlib会出错

时间:2016-10-16 15:45:50

标签: python matplotlib pip

我是python的新手,正在使用pip下载和安装软件包。我在命令窗口运行以下代码并抛出错误

pip install matplotlib

该过程从

开始
Collecting matplotlib
  Using cached matplotlib-1.5.3-cp27-cp27m-win32.whl
Collecting numpy>=1.6 (from matplotlib)
  Using cached numpy-1.11.2-cp27-none-win32.whl
Collecting python-dateutil (from matplotlib)
  Using cached python_dateutil-2.5.3-py2.py3-none-any.whl
Collecting cycler (from matplotlib)
  Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,>=1.5.6 (from matplotlib)
  Using cached pyparsing-2.1.10-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
  Using cached pytz-2016.7-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->matplotlib)
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, python-dateutil, cycler, pyparsing, pytz, matplotlib
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\pip\commands\install.py", line 317, in run
    prefix=options.prefix_path,
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 742, in install
    **kwargs
  File "c:\python27\lib\site-packages\pip\req\req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\python27\lib\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "c:\python27\lib\site-packages\pip\wheel.py", line 346, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\python27\lib\site-packages\pip\wheel.py", line 324, in clobber
    shutil.copyfile(srcfile, destfile)
  File "c:\python27\lib\shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'c:\\python27\\Lib\\site-packages\\numpy\\core\\multiarray.pyd'

它会产生这些追溯错误。我无法弄清楚这些错误是什么以及如何解决它们。请帮忙。它可以很好地工作直到收集包装,但在安装时它会引发错误。

2 个答案:

答案 0 :(得分:2)

尝试python -m pip install matplotlib

  1. 以管理员身份打开cmd
  2. 然后python -m pip install matplotlib

答案 1 :(得分:1)

如果您使用的是Windows,安装许多面向数字的Python软件包的最简单方法是从http://www.lfd.uci.edu/~gohlke/pythonlibs/下载包含预编译二进制文件的一个轮子,并使用pip进行安装:

pip install SomePackage-1.0-py2.py3-none-any.whl

确保为Python安装下载右轮版本(Python2或Python3,32位或64位)。