简体   繁体   English

python:在本地安装matplotlib

[英]python: installing matplotlib locally

I am a user without root privileges on a linux multi-user platform.我是一个在 linux 多用户平台上没有 root 权限的用户。 I would like to install matplotlib (I have seen some questions on stackoverflow but they are old and related to previous versions of matplotlib).我想安装matplotlib (我在 stackoverflow 上看到了一些问题,但它们很旧并且与以前版本的 matplotlib 相关)。 I think the thing I should do is installing from source python -mpip install .我认为我应该做的是从源python -mpip install . . . I cannot find any way to install locally and not globally, as I don't have superuser privilege.由于我没有超级用户权限,我找不到在本地安装而不是全局安装的任何方法。

You can take a look here , on stackexchange the problem were solved.你可以看看这里,在stackexchange上问题已经解决了。

As you can read:正如你可以阅读:

  • Download the matplotlib and install it manually下载 matplotlib 并手动安装
  • install it using pip or easy_install使用 pip 或 easy_install 安装它

Manually :手动

cd /dir/of/your/downloaded/lib
python setup.py install --user

With pip or easy_install :使用 pip 或 easy_install

pip install --user matplotlib
easy_install --prefix=$HOME/.local/ matplotlib

If you have pyenv installed on the system you can easily switch to another python environment that has matplotlib installed.如果您在系统上安装了pyenv ,您可以轻松切换到另一个安装了 matplotlib 的 python 环境。

For example, you can install the latest version of anaconda python, using tab key autocompletion to see which versions are available.比如你可以安装最新版本的anaconda python,使用tab键自动补全来查看有哪些版本可用。

pyenv install anaconda3-5.2.0 

Then you can switch your local python version using然后你可以使用切换你的本地 python 版本

pyenv local anaconda3-5.2.0

Now you can check your python version and matplotlib should be available.现在您可以检查您的 python 版本并且 matplotlib 应该可用。

On the other hand if pyenv is not currently installed, either ask your admin to install it or use a workaround script as describedhere .另一方面,如果当前未安装pyenv ,请让您的管理员安装它或使用此处所述的解决方法脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM