pip 使用時に、 以下のようなメッセージが表示されてインストールが出来ないことがあります。
1 2 3 4 5 6 7 8 |
You should consider upgrading via the 'pip install --upgrade pip' command. You are using pip version x.x.x, however version x.x.x is available. You should consider upgrading via the 'pip install --upgrade pip' command. The directory '/Users/Artemis/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. You are using pip version x.x.x, however version x.x.x is available. You should consider upgrading via the 'pip install --upgrade pip' command. The directory '/Users/Artemis/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. |
対策として、pipのバージョンアップが必要になるわけですが、更新しても解決しない場合があります。
(pipのバージョンが悪いわけではない可能性もあります。)
対策
このような場合は、pip install libname に sudo を付けて実行することをおすすめします。
sudo pip install libname
sudo pip3 install libname
対策
pipのバージョンアップが必要になった場合は、以下のコマンドを利用します。
pipのバージョンアップ
pipはmacの場合、pip3を使用する
pip install –upgrade pip
sudo pip install –upgrade pip
sudo -H pip install –upgrade pip
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
$ pip3 install japanize_matplotlib Requirement already satisfied: japanize_matplotlib in /usr/local/lib/python3.6/site-packages (1.1.2) Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/site-packages (from japanize_matplotlib) (3.2.2) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/site-packages (from matplotlib->japanize_matplotlib) (2.4.7) Requirement already satisfied: numpy>=1.11 in /usr/local/lib/python3.6/site-packages (from matplotlib->japanize_matplotlib) (1.14.3) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/site-packages (from matplotlib->japanize_matplotlib) (1.2.0) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/site-packages (from matplotlib->japanize_matplotlib) (0.10.0) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/site-packages (from matplotlib->japanize_matplotlib) (2.8.1) Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from cycler>=0.10->matplotlib->japanize_matplotlib) (1.15.0) $ sudo pip3 install japanize_matplotlib WARNING: The directory '/Users/username/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting japanize_matplotlib Downloading japanize-matplotlib-1.1.2.tar.gz (4.1 MB) |████████████████████████████████| 4.1 MB 3.0 MB/s Requirement already satisfied: matplotlib in ./opt/anaconda3/lib/python3.7/site-packages (from japanize_matplotlib) (3.1.1) Requirement already satisfied: cycler>=0.10 in ./opt/anaconda3/lib/python3.7/site-packages (from matplotlib->japanize_matplotlib) (0.10.0) Requirement already satisfied: kiwisolver>=1.0.1 in ./opt/anaconda3/lib/python3.7/site-packages (from matplotlib->japanize_matplotlib) (1.1.0) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./opt/anaconda3/lib/python3.7/site-packages (from matplotlib->japanize_matplotlib) (2.4.2) Requirement already satisfied: python-dateutil>=2.1 in ./opt/anaconda3/lib/python3.7/site-packages (from matplotlib->japanize_matplotlib) (2.8.0) Requirement already satisfied: numpy>=1.11 in ./opt/anaconda3/lib/python3.7/site-packages (from matplotlib->japanize_matplotlib) (1.17.2) Requirement already satisfied: six in ./opt/anaconda3/lib/python3.7/site-packages (from cycler>=0.10->matplotlib->japanize_matplotlib) (1.12.0) Requirement already satisfied: setuptools in ./opt/anaconda3/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib->japanize_matplotlib) (41.4.0) Building wheels for collected packages: japanize-matplotlib Building wheel for japanize-matplotlib (setup.py) ... done Created wheel for japanize-matplotlib: filename=japanize_matplotlib-1.1.2-py3-none-any.whl size=4120190 sha256= Stored in directory: /private/tmp/pip-ephem-wheel-cache-euc7nasj/wheels/b8/71/bc/ Successfully built japanize-matplotlib Installing collected packages: japanize-matplotlib Successfully installed japanize-matplotlib-1.1.2 |