【发布时间】:2016-05-11 17:01:29
【问题描述】:
每当我尝试通过终端(最近是 Yelp API Python 包)使用 pip install 时,我都会得到:
Macintosh:~ Ryan$ pip install yelp
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-7.1.0-py2.6.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting yelp
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-7.1.0-py2.6.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-7.1.0-py2.6.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Could not find a version that satisfies the requirement yelp (from versions: )
No matching distribution found for yelp
当我用sudo 尝试它时,我得到了类似的东西,只是包括:
目录“/Users/Ryan/Library/Caches/pip/http”或其父目录不归当前用户所有,缓存已被禁用。请检查该目录的权限和所有者。如果使用 sudo 执行 pip,您可能需要 sudo 的 -H 标志。
当我查找 InsecurePlatformWarning 时,它告诉我升级 Python(我已经完成了),但是当我运行 pip install --upgrade ndg-httpsclient 时,我得到同样的 InsecurePlatformWarning 错误。
如果我尝试使用pip install --upgrade pip 升级pip(因为终端还说“您使用的是 pip 版本 7.1.2,但是版本 8.1.2 可用。”),我也会收到错误:
异常:回溯(最近一次调用最后一次):文件 "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-7.1.0-py2.6.egg/pip/basecommand.py", 第 223 行,主要 status = self.run(options, args) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-7.1.0-py2.6.egg/pip/commands /安装.py", 第 282 行,运行中 requirements_set.prepare_files(finder) 文件“/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-7.1.0-py2.6.egg/pip/req/req_set.py ",
等等
对我来说,问题似乎是 pip 仍在使用 Python 2.6,但即使我已经升级,我也无法让 pip 识别它。例如:
Macintosh:~ Ryan$ python -V
Python 2.6.4
Macintosh:~ Ryan$ python2.7 -V
Python 2.7.10
Macintosh:~ Ryan$ python3.4 -V
Python 3.4.1
Macintosh:~ Ryan$ python3.5 -V
Python 3.5.1
我是 Python 新手,但我更喜欢 2 而不是 3。关于如何解决所有这些问题有什么建议吗?
Macintosh:~ Ryan$ pip -V
pip 7.1.0 from /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-7.1.0-py2.6.egg (python 2.6)
【问题讨论】:
-
你需要使用
sudo pip install ... -
@I'L'I 试过了 - 给了我上面发布的错误:“目录 '/Users/Ryan/Library/Caches/pip/http' 或其父目录不属于所有由当前用户和缓存已禁用。请检查该目录的权限和所有者。如果使用 sudo 执行 pip,您可能需要 sudo 的 -H 标志。"
-
当您尝试将
sudo与upgrade一起使用时,是否仍然出现异常? -
@I'L'I 无论是
sudo pip install还是sudo pip install --upgrade pip,我都会收到我上面发布的相同消息。 -
那不是脚本; the script 在安装文档的开头提到:get-pip.py.
标签: python macos python-2.7 pip