我想在virtualenv中安装特定版本的matplotlib(1.3.1)。我创建了virtualenv,将其激活并运行pip安装。
virtualenv env
. ./env/bin/activate
pip install matplotlib==1.3.1
导致错误“ / tmp / pip-install-UafI0m / matplotlib /中的错误代码为1的命令“ python setup.py egg_info”失败”
我很累的解决方案:
设置: Python 2.7.15rc1 Ubuntu 18.04(仿生)
编辑: 我用一堆其他软件包对其进行了测试,并且能够正确安装所有这些软件包。最终目标是安装s4d。我按照here给出的说明进行了操作。根据要求,列出了matplotlib版本1.3.1。但是,哪种方法可以替代1.3.1?我可以升级到1.4即吗?
编辑2:完整输出
pip2 install matplotlib==1.3.1
Collecting matplotlib==1.3.1
Using cached https://files.pythonhosted.org/packages/d4/d0/17f17792a4d50994397052220dbe3ac9850ecbde0297b7572933fa4a5c98/matplotlib-1.3.1.tar.gz
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.3.1]
python: yes [2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.9.0]
dateutil: yes [using dateutil version 2.2]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [using pyparsing version 2.0.2]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [pkg-config information for 'freetype2' could
not be found.]
png: yes [version 1.2.54]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [using nose version 1.3.4]
OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt4agg: no [PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: no [The C/C++ header for Tk (tk.h) could not be
found. You may need to install the development
package.]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: yes [version 9.25]
latex: no
pdftops: yes [version 0.62.0]
============================================================================
* The following required packages can not be built:
* freetype
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-Ji6dpj/matplotlib/
编辑3:libfreetype2和libagg 因此,我们将其范围缩小到缺少libfreetype(和libagg)。在最近对Ubuntu 18.04进行更新之后,字体渲染出现了很多问题。因此,我使用以下bash命令按照建议的here降级了freetype:
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ artful-updates main"
sudo apt-get update
sudo apt-get install libfreetype6=2.8-0.2ubuntu2.1
sudo apt-mark hold libfreetype6
我检查了freetype是否已安装(是)
ldconfig -p | grep freetype
所以我未标记freetype6并运行了更新,升级和dist-upgrade,然后检查是否可以安装matplotlib,导致相同的错误。有谁知道如何解决这个问题? 我是否必须在pkg-config中进行一些编辑?
sudo apt-mark unhold libfreetype6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
source env/bin/activate
pip install matplotlib==1.3.1
编辑4 /初步解决方案 软件包libfreetype6-dev(sudo apt-get install libfreetype6-dev)有所帮助,因此setup.py / pip现在可以找到libfreetype。但是,我面临的新错误是。但这可能是一个新问题
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
答案 0 :(得分:0)
您是否尝试仅安装matplotlib1.4并尝试s4d是否有效?自从更新的matplotlib版本发布以来,安装指南可能没有更新。