ImportError: No module named matplotlib.pyplot

数万年ぶりにpythonを使っています。

元指導教官から太古の昔に作成した画像の色を変えて!
と言われたからです。

太古の昔に書いたコードを引っ張りだしてきました。

社会人になってから使用しているパソコンには
pythonのライブラリを揃えていなかったので、
タイトルのようなエラーメッセージが出てきました。

パソコンの電源を入れるのも数万年ぶりなので、
めちゃくちゃ苦労しています。

明日も会社だけど、今日付けが変わったところだけど、
たぶんこれから頑張るので、
頑張った軌跡を残しておこうと思います。

ライブラリの名前を間違えた

[xxx@localhost TTTpjoject]$ pip install matplotlib.pyplot
Collecting matplotlib.pyplot
  Could not find a version that satisfies the requirement matplotlib.pyplot (from versions: )
No matching distribution found for matplotlib.pyplot

matplotlib.pyplotはpyplotに含まれる関数的な何かの名前なので
そんな名前のライブラリなんてねーよって怒られた。

管理者権限の存在を忘れてた

[xxx@localhost TTTpjoject]$ pip install matplotlib
(いろいろダウンロードしているが...)
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/six.pyc'
Consider using the `--user` option or check the permissions.

お前にインストールする資格はねえ!と怒られた。

やっとインストールできそう...だった

[xxx@localhost TTTpjoject]$ sudo pip install matplotlib
[sudo] xxx のパスワード:
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
(sudoじゃなくてrootでインストールした方がいいですよ、
と怒られたけれどインストールは進んでる...しかし)
gcc: エラー: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-eCqxZL/subprocess32/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-cSXPnL/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-eCqxZL/subprocess32/

gccで失敗したと怒られた。

過去の私えらい!

太古の昔の私はブログに
「error: command 'gcc' failed with exit status 1」
への対処法を残していたのでそれを実行しました。
[xxx@localhost TTTpjoject]$ sudo yum -y install gcc gcc-c++ kernel-devel
[xxx@localhost TTTpjoject]$ sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel

今度こそ!

[moe@localhost TTTpjoject]$ sudo pip install matplotlib
...
Successfully installed backports.functools-lru-cache-1.6.1 cycler-0.10.0 kiwisolver-1.1.0 matplotlib-2.2.5 numpy-1.16.6 pyparsing-2.4.6 pytz-2019.3 subprocess32-3.5.4
できた!


コメント

このブログの人気の投稿

TypeError: ufunc 'bitwise_xor' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

overleafで画像が表示されない!

エラー: ""C:\U" で始まる文字列の中で 8 進文字なしに '\U' が使われています