172173.com

环境

1
2
3
ProductName:    Mac OS X
ProductVersion: 10.12.6
Python 2.7.10

安装金山云cdn sdk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sudo pip2.7 install ksc-sdk-python
Collecting ksc-sdk-python
Downloading https://files.pythonhosted.org/packages/00/3f/65fafafe3b02ed6c362124ab20e29abe0b8e1d54337985fdc837416c1b54/ksc_sdk_python-1.3.10-py2.py3-none-any.whl (692kB)
|################################| 696kB 343kB/s
Requirement already satisfied: docutils>=0.10 in /Library/Python/2.7/site-packages (from ksc-sdk-python) (0.14)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Library/Python/2.7/site-packages (from ksc-sdk-python) (0.9.4)
Collecting python-dateutil<3.0.0,>=2.1 (from ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
|################################| 235kB 345kB/s
Collecting pyyaml==3.13 (from ksc-sdk-python)
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
ERROR: matplotlib 1.3.1 requires nose, which is not installed.
ERROR: matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: six, python-dateutil, pyyaml, ksc-sdk-python
Found existing installation: six 1.4.1
ERROR: Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

问题

原因是Apple预安装的这个six库出于安全原因被设置为sudo也不可以执行操作,所以需要依赖于高版本的库就需要更新six,但是没有six的权限,所以就会报错。
--ignore-installed  其作用是忽略已安装的某些模块

解决方案

一、跳过验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
sudo pip2.7 install --ignore-installed ksc-sdk-python
Collecting ksc-sdk-python
Downloading https://files.pythonhosted.org/packages/00/3f/65fafafe3b02ed6c362124ab20e29abe0b8e1d54337985fdc837416c1b54/ksc_sdk_python-1.3.10-py2.py3-none-any.whl (692kB)
|################################| 696kB 268kB/s
Collecting docutils>=0.10 (from ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/50/09/c53398e0005b11f7ffb27b7aa720c617aba53be4fb4f4f3f06b9b5c60f28/docutils-0.14-py2-none-any.whl (543kB)
|################################| 552kB 332kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/83/94/7179c3832a6d45b266ddb2aac329e101367fbdb11f425f13771d27f225bb/jmespath-0.9.4-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
|################################| 235kB 445kB/s
Collecting pyyaml==3.13 (from ksc-sdk-python)
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
ERROR: matplotlib 1.3.1 requires nose, which is not installed.
ERROR: matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: docutils, jmespath, six, python-dateutil, pyyaml, ksc-sdk-python
Successfully installed docutils-0.14 jmespath-0.9.4 ksc-sdk-python-1.3.10 python-dateutil-2.8.0 pyyaml-3.13 six-1.12.0

安装成功了,但还是有报错

二、更新版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
brew install python2

sudo pip2.7 install ksc-sdk-python
Collecting ksc-sdk-python
Downloading https://files.pythonhosted.org/packages/00/3f/65fafafe3b02ed6c362124ab20e29abe0b8e1d54337985fdc837416c1b54/ksc_sdk_python-1.3.10-py2.py3-none-any.whl (692kB)
100% |################################| 696kB 416kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/83/94/7179c3832a6d45b266ddb2aac329e101367fbdb11f425f13771d27f225bb/jmespath-0.9.4-py2.py3-none-any.whl
Collecting docutils>=0.10 (from ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/50/09/c53398e0005b11f7ffb27b7aa720c617aba53be4fb4f4f3f06b9b5c60f28/docutils-0.14-py2-none-any.whl (543kB)
100% |################################| 552kB 157kB/s
Collecting python-dateutil<3.0.0,>=2.1 (from ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
100% |################################| 235kB 97kB/s
Collecting pyyaml==3.13 (from ksc-sdk-python)
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->ksc-sdk-python)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: jmespath, docutils, six, python-dateutil, pyyaml, ksc-sdk-python
Successfully installed docutils-0.14 jmespath-0.9.4 ksc-sdk-python-1.3.10 python-dateutil-2.8.0 pyyaml-3.13 six-1.12.0

更新Python 版本,后彻底解决。

 评论