我正在尝试安装matplotlib 2.0.0版。我没有root访问权限,因此无法使用sudo / apt-get当我尝试安装matplotlib时,它显示了对freetype和libpng的依赖。所以,我执行了以下步骤:
wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.34.tar.gz
tar -xzf libpng-1.6.34.tar.gz
cd libpng-1.6.34/
./configure --prefix=/home/$username$/
make
make check
make install
cd ..
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
tar xzf freetype-2.5.3.tar.gz
cd freetype-2.5.3
./configure --prefix=/home/$username$ --without-png
make && make install
export PKG_CONFIG_PATH=/home/$username$/lib/pkgconfig
pip install matplotlib==2.0.0
哪个工作得很好。但是当我import matplotlib.pyplot as plt
时,它会抛出以下错误:
ImportError: libpng16.so.16: cannot open shared object file: No such file or directory