简体   繁体   English

无法在python 2.7上安装matplotlib

[英]Can not install matplotlib on python 2.7

When I tried to install matplotlib 2.2.4 on centos 7.4 , and I run setup.py install , The erros is 当我尝试在centos 7.4上安装matplotlib 2.2.4并运行setup.py install ,错误是

"error: can't copy 'lib/matplotlib/backends/web_backend/jquery-ui-1.12.1': doesn't exist or not a regular file." “错误:无法复制'lib / matplotlib / backends / web_backend / jquery-ui-1.12.1':不存在或不是常规文件。”

But the lib/matplotlib/backends/web_backend/jquery-ui-1.12.1 exists. 但是lib / matplotlib / backends / web_backend / jquery-ui-1.12.1存在。

So who can tell me what to do to fix it. 那么谁能告诉我该怎么做才能解决它。

This error is happening when the package_data glob happens to match a directory. 当package_data glob恰好与目录匹配时,就会发生此错误。 You need to re-write setup.py and change the name of your package to fix it. 您需要重写setup.py并更改软件包名称以进行修复。

Package_data assumes every name matched in the glob is a file, it confuses files and directories. Package_data假定glob中匹配的每个名称都是一个文件,它会使文件和目录混乱。

Modify your setup.py as below: 如下修改您的setup.py:

from distutils.core import setup

setup(name='xxx',
      version='0.1',

      packages=[
          'package',
      ],
      package_data={
          'package': [
              '*.dat',
              'dir/*'
      ],
  },
 )

You just need to change the name of the package_data . 您只需要更改package_data的名称即可。 If the package name is * just add .dat after it. 如果软件包名称为* ,则在其后添加.dat

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM