gpt4 book ai didi

python - 在没有 root 权限的情况下安装 matplotlib 及其依赖项

转载 作者:太空狗 更新时间:2023-10-29 17:39:22 28 4
gpt4 key购买 nike

我想在我拥有帐户 /myhome 且没有 root 权限的服务器上使用 matplotlib。

我下载了 matplotlib 源代码并尝试使用带有用户 sheme 的 distutils 安装它,比如 python setup.py install --user,但它返回了以下消息:

============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
matplotlib: yes [1.3.1]
python: yes [2.7.3 (default, Jan 2 2013, 13:56:14) [GCC
4.7.2]]
platform: yes [linux2]

REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.6.2]
dateutil: yes [using dateutil version 1.5]
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 [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
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 [pkg-config information for 'libpng' could not
be found. Using unknown version.]

OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite]

OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt4agg: yes [installing, Qt: 4.8.2, PyQt4: 4.9.3]
gtk3agg: yes [installing, version 3.2.4]
gtk3cairo: yes [installing, version 3.2.4]
gtkagg: no [The C/C++ header for gtk (gtk/gtk.h) could not
be found. You may need to install the development
package.]
tkagg: no [TKAgg requires Tkinter.]
wxagg: no [requires wxPython]
gtk: no [The C/C++ header for gtk (gtk/gtk.h) could not
be found. You may need to install the development
package.]
agg: yes [installing]
cairo: yes [installing, version 1.8.8]
windowing: no [Microsoft Windows only]

OPTIONAL LATEX DEPENDENCIES
dvipng: yes [version 1.14]
ghostscript: yes [version 9.05]
latex: yes [version 3.1415926]
pdftops: yes [version 0.18.4]

============================================================================
* The following required packages can not be built:
* freetype

似乎缺少'freetype'包,所以我下载了它的源代码,我发现它可以通过运行安装在特定的地方:

./configure --prefix=/myhome/somedir
make
make install

我的问题是:我在哪里安装 freetype 以便 distutils 可以检测到它?

我的第一个想法是将它安装在 /myhome/.local 中,因为这是 distutils 在使用 --user 选项时安装模块的地方。不幸的是,在执行此操作时,我仍然收到与上述相同的消息。

我通过使用 virtualenv 包创建虚拟环境尝试了一些更复杂的事情:

virtualenv /myhome/venv/

然后我在 myhome/venv/ 中安装了 freetype,最后我在这个虚拟环境中运行了 distutils,但它再次给了我同样的信息。

感谢您的帮助,当然,我不会让我的系统管理员为我安装 matplotlib。

PS:肯定与我的问题无关但可能值得注意:我使用 ./configure --prefix=/myhome/somedir --without-png< 安装 freetype 包。如果没有 --without-png 选项,我会收到以下错误:

checking for libpng... configure: error: `libpng-config' not found;
either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables,
or pass `--without-png' to the `configure' script.

最佳答案

你应该安装系统要求,它与python、pip、virtualenv无关。

要安装要求,请参阅此。 https://stackoverflow.com/a/20533455/2962018

简而言之,

Ubuntu/Debian

apt-get install libfreetype6-dev

红帽

yum -y install freetype-devel

操作系统

brew install freetype

安装freetype后,试试

pip install matplotlib

关于python - 在没有 root 权限的情况下安装 matplotlib 及其依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20904841/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com