我正在尝试安装h5py并执行sudo
pip3安装h5py
我还尝试通过来自https://pypi.python.org/pypi/h5py/2.7.0rc2
的滚轮安装h5py我安装了python 3.5。然后pip3与此输出崩溃:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
我在Ubuntu 16.04.3 LTS上运行
我不认为pip3被破坏了,因为之前我安装了很多pip3。
我该怎么办?
非常感谢。
答案 0 :(得分:0)
我会先使用sudo来安装不,但请使用virtualenv。我亲自使用virtualenvwrapper。以下在我当地工作正常。
$ mkvirtualenv bla --python=python3 # Random naming
# Env is activated right away
$ pip3 install h5py
Collecting h5py
Downloading h5py-2.7.1-cp35-cp35m-manylinux1_x86_64.whl (5.3MB)
100% |████████████████████████████████| 5.3MB 340kB/s
Collecting six (from h5py)
Using cached six-1.11.0-py2.py3-none-any.whl
Collecting numpy>=1.7 (from h5py)
Downloading numpy-1.14.0-cp35-cp35m-manylinux1_x86_64.whl (17.1MB)
100% |████████████████████████████████| 17.1MB 118kB/s
Installing collected packages: six, numpy, h5py
Successfully installed h5py-2.7.1 numpy-1.14.0 six-1.11.0