python - 设置 python 时无法使用特定的 gcc 版本
问题描述
CUDA 9.0 和 GCC 6.x 上似乎存在一些冲突(在此处讨论)。所以我决定使用 gcc 5.5 来设置 python 包。
根据答案https://stackoverflow.com/a/25595274/5634636和https://stackoverflow.com/a/16737696/5634636,我尝试运行setup.py
如下:
CC=gcc-5 CXX=g++-5 python setup.py install --user
这引发了错误(我只粘贴了一部分,因为它太长了):
/usr/include/c++/6/tuple:在 'static constexpr bool std::_TC<, _Elements>::_MoveConstructibleTuple() 的实例化中 [with _UElements = {std::tuple};
看来python在编译时仍在使用g++ 6 (/usr/include/c++/ 6 /tuple) 库。如何避免使用 g++ 6?
解决方案
好像有两个地方gcc
用到了。一个是 python setup 本身,另一个是nvcc
. 环境变量CC
,CXX
只指定了 python 的 gcc 版本,但它没有改变nvcc
.
要更改默认使用的 gcc 版本 cuda,请执行以下操作:
sudo unlink /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/gcc-5 /usr/local/cuda/bin/gcc
/usr/bin/gcc-5
您想要使用的 gcc 可以有任何路径。
推荐阅读
- html - 图像上的居中文本在使用 HTML 和 CSS 的网格上重叠
- android - Android API 24 及更低版本上的 PBKDF2WithHmacSHA256
- php - Laravel 添加功能加入
- python - 将 matlab 代码翻译成 python,但 python 速度较慢
- crystal-lang - 哈希.包括?在晶体中产生奇怪的结果
- angular - 登录侧菜单不显示
- docker - 带有构建参数的 ENTRYPOINT 和 CMD
- javascript - AngularJS - 从 ng-repeat 获取当前对象
- php - 如果值相同,如何对 SQL 查询结果进行排序?
- amazon-web-services - aws - 存在分区时如何创建请求