AttributeError:'模块'对象没有属性' argpartsort'

时间:2017-01-21 22:16:11

标签: python-2.7

在python 2.7.9中,我试图在没有sudo访问权限的情况下安装bottleneck并使用其中一个函数argpartsort。但这就是发生的事情:

import bottleneck as bn
bn.argpartsort
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'argpartsort'

我尝试了各种方法:

pip install --user bottleneck
Requirement already satisfied (use --upgrade to upgrade): bottleneck in $HOME/.local/lib/python2.7/site-packages/Bottleneck-1.3.0.dev0-py2.7-linux-x86_64.egg
Requirement already satisfied (use --upgrade to upgrade): numpy in $HOME/.local/lib/python2.7/site-packages (from bottleneck)
Cleaning up...

我尝试从源码构建:

 python setup.py install --user
 Installed $HOME/.local/lib/python2.7/site-packages/Bottleneck-1.3.0.dev0-py2.7-linux-x86_64.egg
 Processing dependencies for Bottleneck==1.3.0.dev0
 Searching for numpy==1.12.0
 Best match: numpy 1.12.0
 Adding numpy 1.12.0 to easy-install.pth file

 Using $HOME/.local/lib/python2.7/site-packages
 Finished processing dependencies for Bottleneck==1.3.0.dev0

然后我尝试了:

pip install --install-option="--prefix=$HOME/.local" bottleneck
Requirement already satisfied (use --upgrade to upgrade): bottleneck in $HOME/.local/lib/python2.7/site-packages/Bottleneck-1.3.0.dev0-py2.7-linux-x86_64.egg
Requirement already satisfied (use --upgrade to upgrade): numpy in $HOME/.local/lib/python2.7/site-packages (from bottleneck)
Cleaning up...

我尝试导出环境变量:

export PYTHONPATH="$HOME/.local/lib/python2.7/site-packages"

但没有任何运气。

我该如何使用:

 >>> import bottleneck as bn
 >>> bn.argpartsort

并解决此错误:

AttributeError: 'module' object has no attribute 'argpartsort'

没有sudo权限

我在:

Distributor ID: Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:    8.6
Codename:   jessie

我感谢你的帮助,无论多么微不足道。

此致

1 个答案:

答案 0 :(得分:0)

您的安装可能没有任何问题。

检查Bottleneck 1.2.0 Release Notes

  

函数set(SOURCE_FILES identifier.cpp enum.cpp main.cpp ) partsort已重命名为argpartsortpartition以匹配NumPy。