Linux 安装pycuda/lap报错 !常见问题解决方法

安装lap安装报错就直接上

conda install -c conda-forge lap

Linux 安装 Pycuda 时可能会遇到这个问题:

第一种问题:
src/cpp/cuda.hpp:14:18: fatal error: cuda.h: No such file or directory
#include <cuda.h>
                  ^
error: command '/usr/bin/gcc' failed with exit code 1

解决方法:

export PATH=/usr/local/cuda-11.7/bin:/usr/local/cuda/bin:$PATH    // 即 cuda 的路径这里在root 模式下再包含一遍即可
pip install pycuda -i https://pypi.tuna.tsinghua.edu.cn/simple
第二种问题:

出现Python.h报错的问题

解决方法:
ubuntu
Python2x:

apt-get intsall -y python-dev

Python3x:

apt-get intsall -y python3-dev

centos
Python2x:

yum intsall -y python-devel

Python3x:

yum intsall -y python3-devel
第三种问题:

在这里插入图片描述

Installing 'pycuda.cuda' as data is deprecated, please list it in `packages`.
note: This error originates from a subprocess, and is likely not a problem with pip.
 ERROR: Failed building wheel for pycuda
Failed to build pycuda
ERROR: Could not build wheels for pycuda, which is required to install pyproject.toml-based projects

解决方法:
进pycuda的官网下载 https://pypi.org/project/pycuda/#files 在这里插入图片描述

方式一:

// 下载
wget https://files.pythonhosted.org/packages/5a/56/4682a5118a234d15aa1c8768a528aac4858c7b04d2674e18d586d3dfda04/pycuda-2021.1.tar.gz
// 解压
tar xvzf pycuda-2021.1.tar.gz
cd pycuda-2021.1
./configure.py --cuda-root=/home/xx/software/cuda-11.7/install/ --boost-compiler=gcc --cxxflags=-std=c++11
// 编译
python setup.py build
// 安装
python setup.py install

方式二:

// 下载pycuda源码
wget https://files.pythonhosted.org/packages/5a/56/4682a5118a234d15aa1c8768a528aac4858c7b04d2674e18d586d3dfda04/pycuda-2021.1.tar.gz
// 解压
tar -xvzf pycuda-2021.1.tar.gz
cd pycuda-2021.1
vim setup.py
// 在下图位置添加conf[“CXXFLAGS”].append(’-std=c++11’)
// 运行
python3 setup.py install
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值