无法pip安装SolrClient(python2.6 vs 3.4问题?)

时间:2016-05-13 04:37:14

标签: solr centos pip python-3.4 python-2.6

我正在尝试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

否则,我不知道如何继续这里。想法?

2 个答案:

答案 0 :(得分:1)

我确实需要使用python3.4

正如所建议的那样,我选择了虚拟环境来完成任务。

buffer = (char*)calloc(strlen(source) + 19, 1);  // Make it 19 or higher.

答案 1 :(得分:0)

sudo apt install virtualenv
virtualenv -p python3 <envname>
cd <envname>
source bin/activate
pip install SolrClient