使用LD_LIBRARY_PATH时将问题与Anaconda联系起来

时间:2013-10-01 19:36:53

标签: python anaconda

我刚尝试在Linux 64位上安装Anaconda。一切似乎都运行良好,但当我尝试从终端启动IPython时,我收到以下错误:

$ ipython
Traceback (most recent call last):
  File "/home/josh/installs/conda/1.7.0/bin/ipython", line 4, in <module>
    from IPython import start_ipython
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/IPython/__init__.py", line 43, in <module>
    from .config.loader import Config
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/IPython/config/__init__.py", line 16, in <module>
    from .application import *
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/IPython/config/application.py", line 27, in <module>
    from collections import defaultdict
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/collections.py", line 9, in <module>
    from operator import itemgetter as _itemgetter, eq as _eq
ImportError: /home/josh/installs/conda/1.7.0/lib/python2.7/lib-dynload/operator.so: undefined symbol: _PyUnicodeUCS4_AsDefaultEncodedString

如果我尝试更新conda,我会收到同样的错误:

$ conda update conda                                                                                                      
Traceback (most recent call last):
  File "/home/josh/installs/conda/1.7.0/bin/conda", line 3, in <module>
    from conda.cli import main
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/conda/cli/__init__.py", line 8, in <module>
    from conda.cli.main import main
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/conda/cli/main.py", line 43, in <module>
    import argparse
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/argparse.py", line 85, in <module>
    import collections as _collections
  File "/home/josh/installs/conda/1.7.0/lib/python2.7/collections.py", line 9, in <module>
    from operator import itemgetter as _itemgetter, eq as _eq
ImportError: /home/josh/installs/conda/1.7.0/lib/python2.7/lib-dynload/operator.so: undefined symbol: _PyUnicodeUCS4_AsDefaultEncodedString

它也很奇怪,因为它看起来像安装了Python 2.7.4而不是Python 2.7.5。我刚刚(10月1日)下载了它。

$ python
Python 2.7.4 (default, Apr 21 2013, 18:37:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

我的.bashrc上有以下内容: PATH=/home/josh/installs/conda/1.7.0/bin:$PATH 这似乎正在发挥作用: $ which python /home/josh/installs/conda/1.7.0/bin/python 我安装了可用版本here。以下是完整的安装日志:

[/home/josh/installs/conda] >>> /home/josh/installs/conda/1.7.0/
PREFIX=/home/josh/conda/1.7.0
installing: python-2.7.5-2 ...
installing: conda-1.9.1-py27_0 ...
installing: _license-1.1-py27_0 ...
installing: apptools-4.2.0-py27_0 ...
installing: astropy-0.2.4-np17py27_1 ...
installing: atom-0.3.2-py27_0 ...
installing: binstar-0.3.1-py27_0 ...
installing: biopython-1.61-np17py27_0 ...
installing: bitarray-0.8.1-py27_0 ...
installing: bokeh-0.1.1-np17py27_0 ...
installing: boto-2.12.0-py27_0 ...
installing: cairo-1.12.2-1 ...
installing: casuarius-1.1-py27_0 ...
installing: chaco-4.3.0-np17py27_1 ...
installing: configobj-4.7.2-py27_0 ...
installing: cubes-0.10.2-py27_3 ...
installing: curl-7.30.0-0 ...
installing: cython-0.19.1-py27_0 ...
installing: dateutil-2.1-py27_2 ...
installing: disco-0.4.4-py27_0 ...
installing: distribute-0.6.45-py27_0 ...
installing: docutils-0.11-py27_0 ...
installing: dynd-python-0.4.2-np17py27_0 ...
installing: enable-4.3.0-np17py27_0 ...
installing: enaml-0.7.19-py27_1 ...
installing: envisage-4.3.0-py27_0 ...
installing: erlang-R15B01-0 ...
installing: flask-0.10.1-py27_1 ...
installing: freetype-2.4.10-0 ...
installing: gevent-0.13.8-py27_0 ...
installing: gevent-websocket-0.3.6-py27_2 ...
installing: gevent_zeromq-0.2.5-py27_2 ...
installing: greenlet-0.4.1-py27_0 ...
installing: grin-1.2.1-py27_1 ...
installing: h5py-2.2.0-np17py27_0 ...
installing: hdf5-1.8.9-0 ...
installing: imaging-1.1.7-py27_3 ...
installing: ipython-1.0.0-py27_0 ...
installing: ipython-notebook-1.0.0-py27_0 ...
installing: ipython-qtconsole-1.0.0-py27_0 ...
installing: itsdangerous-0.23-py27_0 ...
installing: jinja2-2.7.1-py27_0 ...
installing: jpeg-8d-0 ...
installing: keyring-3.0.1-py27_0 ...
installing: launcher-0.1.2-py27_0 ...
installing: libdynd-0.4.2-0 ...
installing: libevent-2.0.20-0 ...
installing: libnetcdf-4.2.1.1-1 ...
installing: libpng-1.5.13-1 ...
installing: libtiff-4.0.2-0 ...
installing: libxml2-2.9.0-0 ...
installing: libxslt-1.1.28-0 ...
installing: llvm-3.3-0 ...
installing: llvmmath-0.1.1-np17py27_2 ...
installing: llvmpy-0.12.0-py27_0 ...
installing: lxml-3.2.3-py27_0 ...
installing: markupsafe-0.18-py27_0 ...
installing: matplotlib-1.3.0-np17py27_0 ...
installing: mayavi-4.3.0-np17py27_1 ...
installing: mdp-3.3-np17py27_0 ...
installing: meta-0.4.2.dev-py27_0 ...
installing: mpi4py-1.3-py27_0 ...
installing: mpich2-1.4.1p1-0 ...
installing: netcdf4-1.0.5-np17py27_0 ...
installing: networkx-1.8.1-py27_0 ...
installing: nltk-2.0.4-np17py27_0 ...
installing: nose-1.3.0-py27_0 ...
installing: numba-0.10.2-np17py27_0 ...
installing: numexpr-2.0.1-np17py27_3 ...
installing: numpy-1.7.1-py27_0 ...
installing: opencv-2.4.6-np17py27_0 ...
installing: openssl-1.0.1c-0 ...
installing: pandas-0.12.0-np17py27_0 ...
installing: patsy-0.2.1-np17py27_0 ...
installing: pep8-1.4.6-py27_0 ...
installing: pip-1.4.1-py27_0 ...
installing: pixman-0.26.2-0 ...
installing: ply-3.4-py27_0 ...
installing: psutil-1.0.1-py27_0 ...
installing: py-1.4.14-py27_0 ...
installing: py2cairo-1.10.0-py27_1 ...
installing: pycosat-0.6.0-py27_0 ...
installing: pycparser-2.9.1-py27_0 ...
installing: pycrypto-2.6-py27_0 ...
installing: pycurl-7.19.0-py27_2 ...
installing: pyface-4.3.0-py27_0 ...
installing: pyflakes-0.7.3-py27_0 ...
installing: pygments-1.6-py27_0 ...
installing: pyparsing-1.5.6-py27_0 ...
installing: pysal-1.6.0-np17py27_1 ...
installing: pysam-0.6-py27_0 ...
installing: pyside-1.2.1-py27_0 ...
installing: pytables-2.4.0-np17py27_0 ...
installing: pytest-2.3.5-py27_0 ...
installing: pytz-2013b-py27_0 ...
installing: pyyaml-3.10-py27_0 ...
installing: pyzmq-2.2.0.1-py27_1 ...
installing: qt-4.8.5-0 ...
installing: readline-6.2-0 ...
installing: redis-2.6.9-0 ...
installing: redis-py-2.7.2-py27_0 ...
installing: requests-1.2.3-py27_0 ...
installing: rope-0.9.4-py27_0 ...
installing: scikit-image-0.8.2-np17py27_2 ...
installing: scikit-learn-0.14.1-np17py27_0 ...
installing: scipy-0.12.0-np17py27_0 ...
installing: shiboken-1.2.1-py27_0 ...
installing: six-1.4.1-py27_0 ...
installing: sphinx-1.1.3-py27_4 ...
installing: spyder-2.2.4-py27_0 ...
installing: spyder-app-2.2.4-py27_0 ...
installing: sqlalchemy-0.8.2-py27_0 ...
installing: sqlite-3.7.13-0 ...
installing: statsmodels-0.5.0-np17py27_0 ...
installing: sympy-0.7.3-py27_0 ...
installing: system-5.8-1 ...
installing: theano-0.5.0-np17py27_1 ...
installing: tk-8.5.13-0 ...
installing: tornado-3.1.1-py27_0 ...
installing: traits-4.3.0-py27_0 ...
installing: traitsui-4.3.0-py27_0 ...
installing: util-linux-2.21-0 ...
installing: vtk-5.10.1-py27_0 ...
installing: werkzeug-0.9.4-py27_0 ...
installing: xlrd-0.9.2-py27_0 ...
installing: xlwt-0.7.5-py27_0 ...
installing: yaml-0.1.4-0 ...
installing: zeromq-2.2.0-1 ...
installing: zlib-1.2.7-0 ...
installing: anaconda-1.7.0-np17py27_0 ...
installing: _cache-0.0-x0 ...
Python 2.7.5 :: Continuum Analytics, Inc.
creating default environment...
installation finished.

Do you wish the installer to prepend the Anaconda install location
to PATH in your /home/josh/.bashrc ? [yes|no]
[no] >>> yes

Prepending PATH=/home/josh/installs/conda/1.7.0/bin to PATH in /home/josh/.bashrc
A backup will be made to: /home/josh/.bashrc-anaconda.bak


For this change to become active, you have to open a new terminal.

Thank you for installing Anaconda!

2 个答案:

答案 0 :(得分:8)

在你的系统上,Anaconda正在挑选一个libpython的“系统版本”,它使用2字节Unicode编译,其中Anaconda是用4字节Unicode构建的。这是一个不寻常的情况,由于某种原因,指示operator.so文件的动态加载器正在拾取你的系统libpython库。

此外,看起来当你运行python时,无论你的PATH是什么,你都会获得标准的“系统”Python。

您是否已启动新终端,或运行#source .bashrc? 您使用的是哪个Linux发行版? 你的环境中是否设置了LD_LIBRARY_PATH?

请注意,https://github.com/ContinuumIO/conda/issues/296也会询问此问题,因此可能会有答案。

答案 1 :(得分:1)

看起来你有两条不同的路径。安装日志说您已安装到/ home / josh / conda中,但您的错误消息是使用路径/ home / josh / installs / conda和您的which python