LoginSignup
11
16

More than 5 years have passed since last update.

macOS Sierraでpip install tweepyしたらエラー出たので対処した

Last updated at Posted at 2017-01-03

解決策

pip--userオプションをつける

% pip install tweepy --user

作業履歴

PyCharmでインストールしようとしたらエラー

sudoで実行してみる

% sudo pip install tweepy                                                                                                               Password:
You are using pip version 7.1.0, however version 9.0.1 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 7.1.0, however version 9.0.1 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.
.
.
.
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pygments'

pipのバージョンで注意される -> 前回バージョンアップしてめんどくさいことになったので無視
所有権で注意される
権限で怒られる

sudo-Hオプションをつけてみる

% sudo -H pip install tweepy                                                                                                            
.
.
.
OSError: [Errno 1] Operation not permitted: '/tmp/pip-SMqSdl-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

エラーが変わったが解決しない

/tmp/pip-SMqSdl-uninstallはroot権限だけどsudoつけてるし...

pip--userオプションをつけたらインストール先を変えられるようだ

% pip install tweepy --user                                                                                                             You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting tweepy
  Downloading tweepy-3.5.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): requests>=2.4.3 in /Library/Python/2.7/site-packages (from tweepy)
Collecting six>=1.7.3 (from tweepy)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting requests-oauthlib>=0.4.1 (from tweepy)
  Downloading requests_oauthlib-0.7.0-py2.py3-none-any.whl
Collecting oauthlib>=0.6.2 (from requests-oauthlib>=0.4.1->tweepy)
  Downloading oauthlib-2.0.1.tar.gz (122kB)
    100% |████████████████████████████████| 126kB 938kB/s
Installing collected packages: six, oauthlib, requests-oauthlib, tweepy
  Running setup.py install for oauthlib
Successfully installed oauthlib requests-oauthlib six-1.4.1 tweepy

できた!

間違いがあればご指摘ください。

参考文献

http://qiita.com/tmsanrinsha/items/d7b69bde61a55038c054
http://qiita.com/ronin_gw/items/cdf8112b61649ca455f5
http://tdoc.info/blog/2014/01/15/pip.html

11
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
16