Tom chan
Tom chan

Reputation: 365

My python console refuses to use the latest version of Six

I have some dependency problems in my python due to the console keep using 1.4.1 version of Six instead of 1.9.

So, on my python IDLE:

>>> import six
>>> six.__version__
'1.4.1'

But on my pip:

$ pip freeze
six==1.9.0

How can i force my IDLE to use the right version?

I tried uninstalling and installing with pip.

Output from python -v, then import six

# /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py
import six # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.pyc
dlopen("/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/operator.so", 2);
import operator # dynamically loaded from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/operator.so
# /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/StringIO.pyc matches /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/StringIO.py
import StringIO # precompiled from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/StringIO.pyc

Upvotes: 2

Views: 1285

Answers (3)

Tom chan
Tom chan

Reputation: 365

Manually install six again (Installing Python Module Six). Sometimes pip is not reliable.

Upvotes: 1

H. Arlinghaus
H. Arlinghaus

Reputation: 69

Make sure you don't have a left over six.pyo / six.pyc file in the current working directory or pythonpath directory.

Upvotes: 1

syntonym
syntonym

Reputation: 7384

You are using a pip and a python from different versions, pip is from /Library/[...] while your python is from /System/Library/[...] You can use python from /Library/[...] or pip from /System/Library/[...]. You could also use use virtualenv. From the documentation:

virtualenv is a tool to create isolated Python environments. [...] It creates an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).

Upvotes: 1

Related Questions