我正在尝试在我的系统上设置elasticsearch
包。
通过conda install
无法使用 - 当前linux-64频道中缺少包。
所以我通过系统pip安装它,并且工作正常:
$ which pip2
/usr/bin/pip2
$ sudo pip2 install elasticsearch
...
$ pip2 list | grep ela
elasticsearch (2.4.0)
elasticsearch-dsl (2.1.0)
但是当我通过康达的点子尝试时:
$ which pip
/home/michal/Bin/anaconda/envs/raptor/bin/pip
$ pip list | grep ela
$
它没有显示出来。这是有道理的,因为我是通过系统完成的。
但如果我尝试安装它:
$ sudo pip install elasticsearch
Requirement already satisfied (use --upgrade to upgrade): elasticsearch in /usr/local/lib/python3.4/dist-packages
Cleaning up...
它已经设置好,但我无法在pip list
或conda list
中列出。如果我不在conda env中,在系统python中导入包,但在conda env中无法导入包。
好的,它在系统中。但是我如何强制它安装到conda?我已经尝试卸载系统conda并通过conda pip安装它,但它再次将其放入usr/local/lib/python3.4/dist-packages/elasticsearch/
我的康茄达信息:
$ conda info -a
Current conda install:
platform : linux-64
conda version : 4.1.6
conda-env version : 2.5.1
conda-build version : 1.21.3
python version : 3.5.2.final.0
requests version : 2.10.0
root environment : /home/michal/Bin/anaconda (writable)
default environment : /home/michal/Bin/anaconda/envs/raptor
envs directories : /home/michal/Bin/anaconda/envs
package cache : /home/michal/Bin/anaconda/pkgs
channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
https://repo.continuum.io/pkgs/free/noarch/
https://repo.continuum.io/pkgs/pro/linux-64/
https://repo.continuum.io/pkgs/pro/noarch/
config file : /home/michal/.condarc
offline mode : False
is foreign system : False
# conda environments:
#
raptor * /home/michal/Bin/anaconda/envs/raptor
tensorflow /home/michal/Bin/anaconda/envs/tensorflow
root /home/michal/Bin/anaconda
sys.version: 3.5.2 |Anaconda 4.1.1 (64-bit)| (default...
sys.prefix: /home/michal/Bin/anaconda
sys.executable: /home/michal/Bin/anaconda/bin/python3
conda location: /home/michal/Bin/anaconda/lib/python3.5/site-packages/conda
conda-build: /home/michal/Bin/anaconda/bin/conda-build
conda-convert: /home/michal/Bin/anaconda/bin/conda-convert
conda-develop: /home/michal/Bin/anaconda/bin/conda-develop
conda-env: /home/michal/Bin/anaconda/bin/conda-env
conda-index: /home/michal/Bin/anaconda/bin/conda-index
conda-inspect: /home/michal/Bin/anaconda/bin/conda-inspect
conda-metapackage: /home/michal/Bin/anaconda/bin/conda-metapackage
conda-pipbuild: /home/michal/Bin/anaconda/bin/conda-pipbuild
conda-render: /home/michal/Bin/anaconda/bin/conda-render
conda-server: /home/michal/Bin/anaconda/bin/conda-server
conda-sign: /home/michal/Bin/anaconda/bin/conda-sign
conda-skeleton: /home/michal/Bin/anaconda/bin/conda-skeleton
user site dirs: ~/.local/lib/python2.7
~/.local/lib/python3.4
CIO_TEST: <not set>
CONDA_DEFAULT_ENV: raptor
CONDA_ENVS_PATH: <not set>
LD_LIBRARY_PATH: <not set>
PATH: /home/michal/Bin/anaconda/envs/raptor/bin:/home/michal/Bin/anaconda/bin:/usr/local/heroku/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/michal/.rvm/bin:/home/michal/Bin:/home/michal/.rvm/bin
PYTHONHOME: <not set>
PYTHONPATH: :/home/michal/Code/BSS/fairalgo/src:/home/michal/Code/BSS/fairalgo/src
WARNING: could not import _license.show_info
# try:
# $ conda install -n root _license
编辑:
通过使用sudo
确实使用了不同的点,我没有意识到:
root@mentat:/home/michal/Bin/anaconda# which pip
/usr/local/bin/pip
当我使用没有sudo的pip时,它会崩溃:
$ pip install elasticsearch
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 236, in run
session = self._build_session(options)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 52, in _build_session
session = PipSession()
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 216, in __init__
super(PipSession, self).__init__(*args, **kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 272, in __init__
self.headers = default_headers()
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/utils.py", line 555, in default_headers
'User-Agent': default_user_agent(),
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/utils.py", line 524, in default_user_agent
_implementation = platform.python_implementation()
File "/usr/lib/python2.7/platform.py", line 1521, in python_implementation
return _sys_version()[0]
File "/usr/lib/python2.7/platform.py", line 1486, in _sys_version
repr(sys_version))
ValueError: failed to parse CPython sys.version: '2.7.11 |Continuum Analytics, Inc.| (default, Jun 15 2016, 15:21:30) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]'
Storing debug log for failure in /tmp/tmpUvOaDo
请帮忙,我完全迷失了。