Unable to upgrade python six package in mac osx 10

2019-01-17 11:15发布

I am trying to install latest version of six python package but I have following issues. Can't get rid of six 1.4.1 in mac OSX 10.10.2

sudo pip install six --upgrade
Requirement already up-to-date: six in /Library/Python/2.7/site-packages
Cleaning up...

pip search six
six - Python 2 and 3 compatibility utilities
INSTALLED: 1.9.0 (latest)

python -c "import six; print six.version"
1.4.1

which -a python
/usr/bin/python
which -a pip
/usr/local/bin/pip

What is wrong here? Can't upgrade six!

10条回答
Animai°情兽
2楼-- · 2019-01-17 11:47

While one or another of the above solutions may work for you, I think it's important to understand what is going on and what are the options that you have. I found this (rather lengthy) description to be very useful: it starts with outlining the options and only then suggests solutions.

查看更多
乱世女痞
3楼-- · 2019-01-17 11:49

Try with pip2 its work for me pip2 install -U six

查看更多
仙女界的扛把子
4楼-- · 2019-01-17 11:52

I resolved the problem by the following method.

  1. Download the six-1.10.0.tar.gz package
  2. Use this command to install it.

python setup.py install

This works because it installs the new version of six to /Library/Python/2.7/site-packages/ which is searched before /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/

查看更多
We Are One
5楼-- · 2019-01-17 11:53

Mac OS X's default python is installed as a framework. Under the framework directory, there is an 'Extras' directory and six package is already placed there.

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py

According to the description (https://github.com/MacPython/wiki/wiki/Which-Python), /System/Library/Frameworks/Python.framework/Versions/2.7/Extras is listed before /Library/Python/2.7/site-packages in module search path. This means all packages already exists in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras can't upgrade.

Maybe you should install python manually and not to use default python.

查看更多
劫难
6楼-- · 2019-01-17 12:03

For me, just using homebrew fixed everything.

brew install python
查看更多
戒情不戒烟
7楼-- · 2019-01-17 12:04

Your pip binary belongs to /usr/local/bin/python, whereas python points to /usr/bin/python. As a consequence

pip install --upgrade six

will install to /usr/local/bin/python.

The command below will make sure that the right version of pip is used:

python -m pip install --upgrade six
查看更多
登录 后发表回答