首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装没有sudo的h5py

安装没有sudo的h5py
EN

Stack Overflow用户
提问于 2016-02-19 17:54:59
回答 1查看 1.3K关注 0票数 1

我正在尝试通过pip为python2.7安装pip包,我不能使用sudo,我也安装了python3.2。

这是我的心愿:

我安装了pip:

代码语言:javascript
复制
curl -O https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py --user

然后我安装了wheel

~/.local/bin/pip2.7 install --user wheel

代码语言:javascript
复制
Collecting wheel
/home/myuser/.local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/myuser/.local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: 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
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.29.0

然后安装了h5py,似乎失败了。

~/.local/bin/pip2.7 install --user h5py

代码语言:javascript
复制
Collecting h5py
  Using cached h5py-2.5.0.tar.gz
/usr/lib/python2.7/dist-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pip was already imported from /home/myuser/.local/lib/python2.7/site-packages/pip/__init__.pyc, but /usr/lib/python2.7/dist-packages is being added to sys.path
  from pkg_resources import Distribution, PathMetadata, ensure_directory
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.1 in /usr/lib/python2.7/dist-packages (from h5py)
Requirement already satisfied (use --upgrade to upgrade): Cython>=0.17 in /home/myuser/.local/lib/python2.7/site-packages (from h5py)
Requirement already satisfied (use --upgrade to upgrade): six in /home/myuser/.local/lib/python2.7/site-packages (from h5py)
Building wheels for collected packages: h5py
  Running setup.py bdist_wheel for h5py ... error
  Complete output from command /usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-7KTR1Y/h5py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpE1KVSupip-wheel- --python-tag cp27:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for h5py
  Running setup.py clean for h5py
Failed to build h5py
Installing collected packages: h5py
  Running setup.py install for h5py ... done
Successfully installed h5py-2.5.0

通过python2.7运行python

代码语言:javascript
复制
Python 2.7.3 (default, Feb 27 2014, 19:58:35) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/myuser/.local/lib/python2.7/site-packages/h5py/__init__.py", line 23, in <module>
    from . import _conv
  File "h5py/h5r.pxd", line 21, in init h5py._conv (/tmp/pip-build-7KTR1Y/h5py/h5py/_conv.c:7356)
  File "h5py/_objects.pxd", line 12, in init h5py.h5r (/tmp/pip-build-7KTR1Y/h5py/h5py/h5r.c:2941)
  File "h5py/_objects.pyx", line 1, in init h5py._objects (/tmp/pip-build-7KTR1Y/h5py/h5py/_objects.c:7226)
ImportError: /home/myuser/.local/lib/python2.7/site-packages/h5py/defs.so: undefined symbol: H5Oexists_by_name 

我做错什么了?

更新:

~/.local/bin/pip2.7 show h5py

代码语言:javascript
复制
---
Metadata-Version: 1.1
Name: h5py
Version: 2.5.0
Summary: Read and write HDF5 files from Python
Home-page: http://www.h5py.org
Author: Andrew Collette
Author-email: andrew dot collette at gmail dot com
License: UNKNOWN
Location: /home/myuser/.local/lib/python2.7/site-packages
Requires: numpy, Cython, six

我的操作系统是Ubuntu12.04.1 LTS。

EN

回答 1

Stack Overflow用户

发布于 2016-02-21 05:56:08

所以这里发生了一些事情:

  1. 缺少SSL证书问题(请参阅urllib3链接)
  2. setuptools没有找到wheel,这意味着车轮没有建立,所以pip直接调用python setup.py install
  3. h5py试图在HDF5中使用一个函数,该函数不存在于系统上的HDF5版本中。

1和2是值得修复的(因为它们可能是系统其他问题的症状),但3是h5py不适合您的原因。

h5py正在尝试访问H5Oexists_by_name。根据H5O.html#Object-ExistsByName的说法,这首先出现在HDF5的1.8.5版本中。根据http://packages.ubuntu.com/source/precise/hdf5,您的系统上的HDF5版本是1.8.4 (但是您需要检查这个!)。不知何故,h5py认为您系统上的HDF5库是1.8.5或更高(参见https://github.com/h5py/h5py/blob/4ee8f89b6dc658fdea5dc62d0f29058121928cfe/h5py/h5o.pyx#L172)

看起来其他人遇到了类似的问题,并提交了https://bugs.launchpad.net/ubuntu/+source/hdf5/+bug/1418220。您可能希望将您的问题告知他们,以便他们能够产生错误修复。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35511730

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档