安装时出现一些错误和问题 "matplotlib"

I get some error and problems when install "matplotlib"

我在“/home/name/pyenv”上获得了 python2.7.9 的虚拟环境; 现在我想为它安装 'matplotlib'; 然后我激活这个虚拟环境并安装 'matplotlib' 如下:


正在清理... 命令 python setup.py egg_info 失败,错误代码为 /tmp/pip-build-tYCFkL/matplotlib 异常信息: 追溯(最近一次通话): 主文件“/home/caofa/odoo-9.0/local/lib/python2.7/site-packages/pip/basecommand.py”,第 122 行 状态 = self.run(选项,参数) 文件“/home/caofa/odoo-9.0/local/lib/python2.7/site-packages/pip/commands/install.py”,第 290 行,在 运行 中 requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) 文件“/home/caofa/odoo-9.0/local/lib/python2.7/site-packages/pip/req.py”,第 1230 行,在 prepare_files 中 req_to_install.run_egg_info() 文件“/home/caofa/odoo-9.0/local/lib/python2.7/site-packages/pip/req.py”,第 326 行,在 运行_egg_info command_desc='python setup.py egg_info') 文件“/home/caofa/odoo-9.0/local/lib/python2.7/site-packages/pip/util.py”,第 716 行,在 call_subprocess 中 % (command_desc, proc.returncode, cwd)) 安装错误:命令 python setup.py egg_info 失败,错误代码为 /tmp/pip-build-tYCFkL/matplotlib

我想用方法一安装,但是不知道虚拟环境怎么安装

一种可能性是全局安装 matplotlib,然后使用 站点包创建您的 virtualenv,请参阅 here 以找到具有完全相同问题的人,方法是使用 virtualenv --system-site-packages 然后你可以激活你的 virtualenv 并添加额外的包,或者只在你的 virtualenv 中更新它们。

我有理由相信你甚至可以在你的 virtualenv 中卸载全局安装的包而不影响你的全局安装,但建议你选择一个你可以轻松重新安装的小包来尽早测试它。