python - 安装 matplotlib 时出错

标签 python linux matplotlib terminal installation

我正在 linux 上的 python 中安装 matplotlib。

我使用了下面的命令来安装。

pip install matplotlib

它显示以下错误:

error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pylab.py'

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_grayhat/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-YC1nG2-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_grayhat/matplotlib
Traceback (most recent call last):
   File "/usr/bin/pip", line 9, in <module>
   load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
   File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
   File "/usr/lib/python2.7/di`enter code here`st-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 40: ordinal not in range(128)

最佳答案

尝试:

sudo pip install matplotlib

您的用户帐户无权写入 /usr/local/lib/python2.7/dist-packages,但 root 有权限。

关于python - 安装 matplotlib 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32964306/

相关文章:

python - Twisted Python 接口(interface)实例是否可以不实现该接口(interface)的所有功能?

c - GCC 为什么以及如何编译缺少 return 语句的函数?

python - 为什么基于矢量的图像文件包含损坏的字符?

python-3.x - Pandas DataFrame.plot 未正确设置 xlim 和 ylim

python - 如何使用 Q 对象和 & 运算符对查询集的值进行过滤查询?

python - 具有多个参数的用户定义函数返回 NULL 值

python - 如何构建正则表达式捕获索引

python - clang.cindex.Libclang错误 "Undefined symbol clang_CXXRecord_isAbstract"

linux - 如何在 Ubuntu 上获取 Docker 桌面?

python - matplotlib 在 Windows 上的 Python 2.7.3 中中断 str( )