2017-01-16 94 views
0

我想在我的Mac TensorFlow升级六点,我所做的:无法在Mac OS X中的优胜美地升级6

sudo pip install --ignore-installed six 

我也得到:

The directory '/Users/lingxiao/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. 
The directory '/Users/lingxiao/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Collecting six 

/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning. 
    SNIMissingWarning 
/Library/Python/2.7/site- 

packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning. 
    InsecurePlatformWarning 
    Downloading six-1.10.0-py2.py3-none-any.whl 
Installing collected packages: six 
Successfully installed six-1.10.0 

的一点是,它以成功安装结束。但是,当我进入IPython的解释做:

import six 
six.__version__ 

我仍然看到1.4.1。解决办法是什么?

+0

您的'IPython'可能被设置为使用与可执行'pip'不同的Python可执行文件。因此'pip'安装一个Python版本,而'IPython'则运行另一个Python版本。看看你的'pip'脚本和'ipython'脚本的第一行,看看它们指向哪个Python可执行文件。 – Evert

+0

好的你是对的。在'python'中检查pip .__ version__让我获得1.10.0和TensorFlow的预期功能。我如何确保iPython正在调用适当的六个版本?这个ipython脚本在哪里? – chibro2

+0

你可以通过键入'which ipython'或'type ipython'找到'IPython'脚本。那么它将取决于你是否想要使用IPython正在使用的Python可执行文件(因此,为该Python安装'six'),或者你想要改变'ipython'脚本的第一行。但是请注意,那么可能找不到模块,或者可能找不到IPython本身。 – Evert

回答

0

使用-U or --upgrade升级包:

sudo pip install --upgrade six 

选项1:

在IPython中:

import pip 

def install(package): 
    pip.main(['install', package]) 

install('six') 

选项2:

在IPython中:

import sys 
sys.path 

然后查看安装的IPython的包在哪里。它应该看起来像这样:

'/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/six-1.4.1 blah blah' 

在您的终端python中执行相同的操作以找到您安装新的六个软件包的位置。然后将这个较新的六个软件包复制到ipython site-packages目录中(将six-1.4.1软件包先移到另一个目录中以防万一)。

之后,注册新的封装成IPython中:

# use your six located in your ipython path 
six_path = '/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/six-1.10.0 blahblah' 
sys.path.append(six_path) 

然后你就可以

import six 

IPython中应重启保持较新的6包的轨道。

+0

没有,并且仍然有6个1.4.1在我的Python – chibro2

+0

@ chibro2完成添加选项。 – ooknosi

+0

这些都是围绕实际问题的窍门;它不会解决未来的问题。如果'ipython'碰巧是一个Python 3脚本,那么路径设置就会失败。 – Evert

相关问题