python3.3以降では、
python3.3以前だと、
Mac OS El Caption で、
一手間に
参考
実施した こと
pip インストール
コマンド
コマンドをpip install mock
実行した ところ、 以下の エラーが 発生しました。 エラー内容
Installing collected packages: six, funcsigs, pbr, mock Found existing installation: six 1.4.1 DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. Uninstalling six-1.4.1: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run prefix=options.prefix_path, File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install requirement.uninstall(auto_confirm=True) File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall paths_to_remove.remove(auto_confirm) File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove renames(path, new_path) File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames shutil.move(old, new) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move copy2(src, real_dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2 copystat(src, dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat os.chflags(dst, st.st_flags) OSError: [Errno 1] Operation not permitted: '/var/folders/x7/8dsf6p5x2vb0cgxf8x1w21jm0000gn/T/pip-KZoyPu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
sudo 付きで pip インストール
権限が
コマンド
sudo pip install mock
実行結果
エラーは変わらずでした。
Web検索したところ、 以下記事に 記載されている six
という ライブラリに 由来する エラーのようです。
Sixのエラーで AWS CLIを Macに インストールできない | // sakura note
six を 除外して pip インストール
--ignore-installed six
を
コマンド
sudo pip install mock --upgrade --ignore-installed six
実行結果
Successfully installed funcsigs-1.0.2 mock-2.0.0 pbr-0.10.7 six-1.4.1
インストール成功しました。
テストを 実行
確認の
コマンド
python runtests.py
実行結果
以下、エラーが 発生しました。 File "/Library/Python/2.7/site-packages/mock/__init__.py", line 2, in <module> import mock.mock as _mock File "/Library/Python/2.7/site-packages/mock/mock.py", line 68, in <module> from six import wraps ImportError: cannot import name wraps
エラーの 解決方法
Web検索した six 古い
.bash_profile にconsole export PYTHONPATH="/Library/Python/2.7/site-packages:$PYTHONPATH"
訂正
PYTHONPATH を
この
手順を
以下、six
の
pip list | grep six ------------------------------- six (1.10.0) -------------------------------
テストの 再実行
再度テストを
python runtests.py --------------------------------------- Ran 1 test in 0.014s OK
以上です。
コメント