我似乎找不到这方面的文档。 Matplotlib 表示要运行:
sudo yum install python-matplotlib
它成功安装了所有依赖项和此版本的 matplotlib:
python-matplotlib.x86_64 0:0.99.1.2-1.6.amzn1
不过我用的是python2.7,单独安装的。原始(并且仍然存在)python2.6 现在成功导入 matplotlib。 RedHat上有python2.7的相关matplotlib包吗?我不知道how to use this page on python-matplotlib packages .
其他信息:
which python2.6
返回/usr/bin/python2.6
which python
返回/usr/bin/python
。cat/proc/version
返回
Linux 版本 3.14.23-22.44.amzn1.x86_64 ...(Red Hat 4.8.2-16)(GCC)...
我尝试过的其他东西:
我也尝试使用pip2.7代替,installed all the dependancies ,它broke on this issue关于权限。解决方案是重置问题文件的权限:
chmod o+x /path/to/file
但是,这是一个临时复制的文件。 :( 在安装 matplotlib 期间,它会重新复制此文件,因此我无法对其设置权限。这是它损坏的地方:
g++ ... -lpython2.7 -o build/lib.linux-x86_64-2.7/matplotlib/backends/_backend_agg.so
running install_lib
copying pylab.py -> /usr/lib64/python2.7/site-packages
error: [Errno 13] Permission denied: '/usr/lib64/python2.7/site-packages/pylab.py'
这似乎不是正确的做法,它太拼凑在一起了。
首先在 Unix&Linux stackexchange 提出问题.
最佳答案
我从源代码构建。 :( 令人惊讶的是,并没有那么困难,但是在进行交互部分时遇到了很多问题(Redhat 4 太旧了,无法提供用于大多数让你做交互后端的东西的软件包,我需要一台更新的机器)。
# get matplotlib
wget https://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.4.3/matplotlib-1.4.3.tar.gz
#uncompress
tar xvzf matplotlib-1.4.3.tar.gz
# open build install
# read INSTALL file for more instructions
cd matplotlib-1.4.3
python setup.py build
# actually installing needed superuser privileges
sudo python setup.py install
希望这可以为具有类似设置的其他人节省时间。
关于python - 最好使用 yum 在 RedHat 上安装 matplotlib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29038507/