numpy delete

手动安装
 sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy/
 sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy-*.egg*
sudo rm -rf /usr/local/bin/f2py

pip安装
 sudo rm -rf /usr/local/lib/python2.7/dist-packages/numpy/
 sudo rm -rf /usr/local/lib/python2.7/dist-packages/numpy-*.egg*
sudo rm -rf /usr/local/bin/f2py

export BLAS=~/.local/lib/libopenblas.a
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.local/lib/

30down voteaccepted

I just compiled numpy inside a virtualenv with OpenBLAS integration, and it seems to be working ok. This was my process:

  1. Compile OpenBlas:

    git clone git://github.com/xianyi/OpenBLAS
    cd OpenBLAS && make FC=gfortran
    sudo make PREFIX=/opt/OpenBLAS install
    sudo ldconfig
  2. Grab the numpy source code:
    git clone https://github.com/numpy/numpy
    cd numpy
  3. Copy site.cfg.example to site.cfg and edit the copy:
    cp site.cfg.example site.cfg
    nano site.cfg

    Uncomment these lines:

    ....
    [openblas]
    libraries = openblas
    library_dirs = /opt/OpenBLAS/lib
    include_dirs = /opt/OpenBLAS/include
    ....
  4. Check configuration, build, install (optionally in a virutalenv)
    python setup.py config

    The output should look something like this:

    ...
    openblas_info:
      FOUND:
        libraries = [‘openblas‘, ‘openblas‘]
        library_dirs = [‘/opt/OpenBLAS/lib‘]
        language = f77
    
      FOUND:
        libraries = [‘openblas‘, ‘openblas‘]
        library_dirs = [‘/opt/OpenBLAS/lib‘]
        language = f77
    ...

    Then just build and install:

    python setup.py build && python setup.py install
  5. Optional: you can use this script to test performance for different thread counts.
    OMP_NUM_THREADS=1 python build/test_numpy.py
    
    FAST BLAS
    version: 1.8.0.dev-27690e3
    maxint: 9223372036854775807
    
    dot: 0.100896406174 sec
    
    OMP_NUM_THREADS=8 python test_numpy.py
    
    FAST BLAS
    version: 1.8.0.dev-27690e3
    maxint: 9223372036854775807
    
    dot: 0.0660264015198 sec

There seems to be a noticeable improvement in performance for higher thread counts. However, I haven‘t tested this very systematically, and it‘s likely that for smaller matrices the additional overhead would outweigh the performance benefit from a higher thread count.


share|improve this answer

edited Jul 3 at 15:16

answered Jan 18 ‘13 at 2:50

ali_m
7,0352055

 

1  

I apply what you did bu tending with foollowing error at your test script /linalg/lapack_lite.so: undefined symbol: zgelsd_ –  Erogol Jan 30 at 17:47 
1  

@Erogol Could you check that lapack_lite.so is correctly linked against the libopenblas.so you just built? You can call ldd /<path-to-site-packages>/numpy/linalg/lapack_lite.so - if you installed OpenBLAS with PREFIX=/usr/local you should see something like libopenblas.so.0 => /usr/local/lib/libopenblas.so.0 in the output. –  ali_m Jan 30 at 18:01 
1  

I have following line even I do strictly what you typed above answer. libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x00007f77e08fc000) –  Erogol Jan 30 at 18:06 
    

It sounds like numpy has not been built correctly. I would suggest you uninstall the broken copy of numpy, do a python setup.py clean and python setup.py build and look for any error messages during the compilation. –  ali_m Jan 30 at 18:14 
    

Also, you should probably call sudo ldconfig after installing OpenBLAS if you haven‘t already (I‘ve added this line to my answer) –  ali_m Jan 30 at 18:21

numpy delete,布布扣,bubuko.com

时间: 2024-11-15 10:49:12

numpy delete的相关文章

numpy delete方法

import numpy as np lines = np.loadtxt(r'./test.txt',delimiter=',',dtype=int) print(lines) lines_copy = lines lines_rest = np.delete(lines,0,0) #第一个参数:要处理的矩阵,第二个参数,处理的位置,第三个参数,0表示按照行删除,1表示按照列删除 #返回值为,删除后的剩余元素构成的矩阵 print('copy') print(lines_copy) print

Python之Numpy详细教程

NumPy - 简介 NumPy 是一个 Python 包. 它代表 “Numeric Python”. 它是一个由多维数组对象和用于处理数组的例程集合组成的库. Numeric,即 NumPy 的前身,是由 Jim Hugunin 开发的. 也开发了另一个包 Numarray ,它拥有一些额外的功能. 2005年,Travis Oliphant 通过将 Numarray 的功能集成到 Numeric 包中来创建 NumPy 包. 这个开源项目有很多贡献者. NumPy 操作 使用NumPy,开

1,Python常用库之一:Numpy

Numpy支持大量的维度数组和矩阵运算,对数组运算提供了大量的数学函数库! Numpy比Python列表更具优势,其中一个优势便是速度.在对大型数组执行操作时,Numpy的速度比Python列表的速度快了好几百.因为Numpy数组本身能节省内存,并且Numpy在执行算术.统计和线性代数运算时采用了优化算法. Numpy的另一个强大功能是具有可以表示向量和矩阵的多维数组数据结构.Numpy对矩阵运算进行了优化,使我们能够高效地执行线性代数运算,使其非常适合解决机器学习问题. 与Python列表相比

Python3快速入门(十二)——NumPy

Python3快速入门(十二)--NumPy 一.NumPy简介 1.NumPy简介 NumPy(Numerical Python) 是 Python 语言的一个扩展程序库,支持大量的维度数组与矩阵运算,同时对数组运算提供了大量的数学函数库.Numpy 是一个运行速度非常快的数学库,内部解除了CPython的GIL(全局解释器锁),运行效率极好,主要用于数组计算,是大量机器学习框架的基础库,NumPy主要包括如下:(1)强大的N维数组对象 ndarray(2)广播功能函数(3)整合 C/C++/

Numpy | 12 数组操作

Numpy 中包含了一些函数用于处理数组,大概可分为以下几类: 修改数组形状 翻转数组 修改数组维度 连接数组 分割数组 数组元素的添加与删除 一.修改数组形状 函数 描述 reshape 不改变数据的条件下修改形状 flat 数组元素迭代器 flatten 返回一份数组拷贝,对拷贝所做的修改不会影响原始数组 ravel 返回展开数组 numpy.reshape numpy.reshape 函数可以在不改变数据的条件下修改形状 numpy.reshape(arr, newshape, order

Kaggle新手入门之路

学完了Coursera上Andrew Ng的Machine Learning后,迫不及待地想去参加一场Kaggle的比赛,却发现从理论到实践的转变实在是太困难了,在此记录学习过程. 一:安装Anaconda 教程大多推荐使用Jupyter Notebook来进行数据科学的相关编程,我们通过Anaconda来安装Jupyter Notebook和需要用到的一些python库,按照以下方法重新安装了Anaconda,平台Win10 Anaconda安装 二:Jupyter Notebook 参照以下

遗传算法解决0-1背包问题

1 import numpy 2 import matplotlib.pyplot as plt 3 4 5 data = numpy.array([[77, 92], 6 [22, 22], 7 [29, 87], 8 [50, 46], 9 [99, 90]]) 10 11 12 class GA(object): 13 """ 14 遗传算法解决0-1背包问题 15 """ 16 17 def __init__(self, length,

《Python数据分析常用手册》一、NumPy和Pandas篇

一.常用链接: 1.Python官网:https://www.python.org/ 2.各种库的whl离线安装包:http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn 3.数据分析常用库的离线安装包(pip+wheels)(百度云):http://pan.baidu.com/s/1dEMXbfN 密码:bbs2 二.常用库 1.NumPy NumPy是高性能科学计算和数据分析的基础包.部分功能如下: ndarray, 具有矢量算术运算和

NumPy和Pandas常用库

NumPy和Pandas常用库 1.NumPy NumPy是高性能科学计算和数据分析的基础包.部分功能如下: ndarray, 具有矢量算术运算和复杂广播能力的快速且节省空间的多维数组. 用于对整组数据进行快速运算的标准数学函数(无需编写循环). 用于读写磁盘数据的工具以及用于操作内存映射文件的工具. 线性代数.随机数生成以及傅里叶变换功能. 用于集成C.C++.Fortran等语言编写的代码的工具. 首先要导入numpy库:import numpy as np A NumPy函数和属性: 类型