Debug报错:THC\THC.h: No such file or directory; pip从.git子文件夹中安装指定分支

Debug报错:THC\THC.h: No such file or directory; pip从.git子文件夹中安装

问题1描述
编译Pointnet2.PyTorch仓库中的setup.py时报THC\THC.h: No such file or directory。

问题解决
原因是THC.h在pytorch 1.11版本中被移除了,需要修改代码。仓库issues给除了解决方法:

//Comment Out /src/ball_query.cpp group_points.cpp interpolate.cpp pointnet2_api.cpp sampling.cpp
把上面列出的文件的以下行注释掉
//#include 
//extern THCState *state;
//cudaStream_t stream = THCState_getCurrentStream(state);

改为
#include 
#include 
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

然后
replace the AT_CHECK with TORCH_CHECK in the ball_query.cpp

问题2描述
部分仓库中setup.py文件在子文件夹中,需要使用pip install 从子文件夹中直接安装某个分支

解决方案
比如上面这个PointNet2.Pytorch仓库的setup.py在子文件夹pointnet2中,可以这样安装branch分支:

pip install git+https://github.com/sshaoshuai/Pointnet2.PyTorch.git@master#subdirectory=pointnet2

你可能感兴趣的:(Debug经验,git,pip,python)