【发布时间】:2016-05-13 04:37:14
【问题描述】:
我正在尝试 pip install SolrClient,我相信我的 python 版本有些困难。
这是错误信息。
[root@centos64 ~]# pip install SolrClient
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting SolrClient
Using cached SolrClient-0.1.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-UeQsqQ/SolrClient/setup.py", line 4, in <module>
import SolrClient
File "SolrClient/__init__.py", line 1, in <module>
from .solrclient import SolrClient
File "SolrClient/solrclient.py", line 10, in <module>
from .collections import Collections
File "SolrClient/collections.py", line 7, in <module>
from collections import defaultdict
ImportError: cannot import name defaultdict
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-UeQsqQ/SolrClient/
所以,当我去检查我的python版本时,它是2.6
[root@centos64 ~]# python -V
Python 2.6.6
我的机器上有 python 3.4,尽管我需要这样称呼它
[root@centos64 ~]# python3.4 -V
Python 3.4.3
所以,有几个问题。
我是否正确地假设我的错误是由于我尝试使用 python2.6 进行 pip 安装?
如果是这样,我该怎么做
a) 告诉 pip 使用 python3.4 版本? (不确定这是否是正确的思考方式)
b) 调整我的系统以使用 python3.4
否则,我不确定如何在此处继续。想法?
【问题讨论】:
-
Am I correct in my assumption that my error is due to the fact that I am attempting to pip install using python2.6?- 是的。处理这种情况的干净方法是创建一个 virtualenv 并作为默认 python 放入您的PATH -
使用我假设的 pew?
-
我刚刚点击了你提供的 SolrClient 的链接,我看到上面写得很清楚,它需要 py3.3 及更高版本意味着它不适用于 python2.x
标签: solr centos pip python-3.4 python-2.6