c++ 未安装BLAS/LAPACK:如何安装?

kg7wmglp  于 2023-06-25  发布在  其他
关注(0)|答案(3)|浏览(235)

我试图运行python2.7的pip install tsne,但总是出现同样的错误。我按照http://bickson.blogspot.com/2011/02/installing-blaslapackitpp-on-amaon-ec2.html上的说明,安装了LAPACK/BLAS,我认为应该解决了问题。什么都没用。我做错了什么?我不太熟悉bash。

  1. running build_ext
  2. cythoning tsne/bh_sne.pyx to tsne/bh_sne.cpp
  3. building 'bh_sne' extension
  4. creating build/temp.linux-x86_64-2.7
  5. creating build/temp.linux-x86_64-2.7/tsne
  6. creating build/temp.linux-x86_64-2.7/tsne/bh_sne_src
  7. x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/ubuntu/env/work/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -Itsne/bh_sne_src/ -I/usr/include/python2.7 -c tsne/bh_sne_src/quadtree.cpp -o build/temp.linux-x86_64-2.7/tsne/bh_sne_src/quadtree.o -msse2 -O3 -fPIC -w
  8. cc1plus: warning: command line option ‘-Wstrict-prototypes is valid for C/ObjC but not for C++ [enabled by default]
  9. x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/ubuntu/env/work/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -Itsne/bh_sne_src/ -I/usr/include/python2.7 -c tsne/bh_sne_src/tsne.cpp -o build/temp.linux-x86_64-2.7/tsne/bh_sne_src/tsne.o -msse2 -O3 -fPIC -w
  10. cc1plus: warning: command line option ‘-Wstrict-prototypes is valid for C/ObjC but not for C++ [enabled by default]
  11. x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/ubuntu/env/work/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -Itsne/bh_sne_src/ -I/usr/include/python2.7 -c tsne/bh_sne.cpp -o build/temp.linux-x86_64-2.7/tsne/bh_sne.o -msse2 -O3 -fPIC -w
  12. cc1plus: warning: command line option ‘-Wstrict-prototypes is valid for C/ObjC but not for C++ [enabled by default]
  13. c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/tsne/bh_sne_src/quadtree.o build/temp.linux-x86_64-2.7/tsne/bh_sne_src/tsne.o build/temp.linux-x86_64-2.7/tsne/bh_sne.o -L/usr/local/lib -o build/lib.linux-x86_64-2.7/bh_sne.so -lcblas
  14. /usr/bin/ld: cannot find -lcblas
  15. collect2: error: ld returned 1 exit status
  16. error: command 'c++' failed with exit status 1
  17. ----------------------------------------
  18. Cleaning up...
  19. Command /home/ubuntu/env/work/bin/python -c "import setuptools, tokenize;__file__='/home/ubuntu/env/work/build/tsne/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3X17dU-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/env/work/include/site/python2.7 failed with error code 1 in /home/ubuntu/env/work/build/tsne
  20. Traceback (most recent call last):
  21. File "/home/ubuntu/env/work/bin/pip", line 11, in
  22. sys.exit(main())
  23. File "/home/ubuntu/env/work/local/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
  24. return command.main(cmd_args)
  25. File "/home/ubuntu/env/work/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
  26. text = '\n'.join(complete_log)
  27. UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)
ne5o7dgx

ne5o7dgx1#

Ubuntu没有cblas或openblas的二进制发行版,根据github,这是tsne所必需的。然而,Ubuntu上可用的ATLAS附带了预编译的cblas。
在Ubuntu和Debian中,应该使用:

  1. apt-get install libatlas-base-dev

https://launchpad.net/ubuntu/+source/atlas
如果你需要不同的编译器选项,你必须自己构建openblas。
检查/usr/lib中是否有libcblas.a
已编辑:已更正软件包名称。

a64a0gku

a64a0gku2#

使用这个:

  1. sudo apt-get install libblas-dev liblapack-dev
gv8xihay

gv8xihay3#

下载一份OpenBLAS并自己编译它。使用make install将其安装到/usr/local中。在官方仓库中有OpenBLAS和ATLAS包以及其他任何东西,但它们的性能值得怀疑。

相关问题