没有root特权安装matplotlib及其依赖项 [英] Installing matplotlib and its dependencies without root privileges
问题描述
我想在拥有root特权/myhome
的服务器上使用matplotlib.
I want to use matplotlib on a server where I have an account /myhome
without root privileges.
我下载了matplotlib源代码,并尝试使用distutils和sheme用户安装它,例如python setup.py install --user
,但是它返回了以下消息:
I downloaded the matplotlib sources and tried to install it using the distutils with the user sheme, say python setup.py install --user
, but it returned the following message :
============================================================================
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"软件包,因此我下载了源代码,发现可以通过运行以下命令将其安装在特定位置:
It seemed that the package 'freetype' was missing, so I downloaded its sources, and I found that it could be installed in a specific place by running:
./configure --prefix=/myhome/somedir
make
make install
我的问题是:我应该在哪里安装freetype,以便distutils可以检测到它?
我的第一个想法是将其安装在/myhome/.local
中,因为这是使用--user
选项时distutils安装模块的地方.
不幸的是,这样做时,我仍然收到与上面相同的消息.
My first thought was to install it in /myhome/.local
because this is where the distutils install a module when using the --user
option.
Unfortunately, when doing this, I still got the same message as above.
我尝试通过使用virtualenv软件包创建虚拟环境来进行更复杂的操作:
I tried something more complicated by creating a virtual environment using the virtualenv package :
virtualenv /myhome/venv/
然后我在myhome/venv/
中安装了freetype,最后在这个虚拟环境中运行了distutils,但是它再次给了我相同的信息.
Then I installed freetype in myhome/venv/
and finally I ran the distutils within this virtual environnement, but it gave me the same message again.
谢谢您的帮助,当然,我也不会要求系统管理员为我安装matplotlib.
Thank you for helping, and, of course, I won't ask my sysadmin to install matplotlib for me.
PS :某些问题与我的问题无关,但可能值得注意:我使用./configure --prefix=/myhome/somedir --without-png
安装freetype软件包.如果没有--without-png
选项,则会出现以下错误:
PS: something certainly unrelated with my problem but maybe worth noting : I install the freetype package by using ./configure --prefix=/myhome/somedir --without-png
. Without the --without-png
option, I get the following error:
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无关.
You should install system requirements, and it doesn't not related to python, pip, virtualenv.
要安装要求,请参阅此. https://stackoverflow.com/a/20533455/2962018
To install the requirements, please refer this. https://stackoverflow.com/a/20533455/2962018
简而言之,
Ubuntu/Debian
Ubuntu/Debian
apt-get install libfreetype6-dev
Redhat
yum -y install freetype-devel
OSX
brew install freetype
安装freetype后,尝试
After installing freetype, try
pip install matplotlib
这篇关于没有root特权安装matplotlib及其依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!