目录
2. Ubuntu 系统使用进入,自动进入base虚拟环境解决方法
3. Ubuntu 终端输入python,提示找不到命令“python”
4. error: pycocotools/_mask.c: 没有那个文件或目录.
7. AttributeError: ‘Upsample’ object has no attribute ‘recompute_scale_factor’.
1. ubuntu环境变量设置:
ubuntu添加环境变量_ubuntu 添加环境变量-优快云博客
建议:使用方法三
解决ubuntu18.04下 提示“conda:未找到命令”问题
- 打开/etc/environment文件,此文件包含系统级别的环境变量设置。你可以使用文本编辑器添加或修改PATH变量:sudo nano /etc/environment
- 在文件中找到PATH变量,并在其后面添加你的路径,多个路径之间用冒号分隔:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:<anaconda3路径>"
anaconda3路径:"/home/a7046/anaconda3”
- 保存并关闭文件。可以按Ctrl + X,然后按Y确认保存,最后按Enter退出
2. Ubuntu 系统使用进入,自动进入base虚拟环境解决方法
解决方法:打开终端,设置conda config –set auto_activate_base false.
3. Ubuntu 终端输入python,提示找不到命令“python”
您的意思是:
command 'python3' from deb python3
command 'python' from deb python-is-python3
解决方法:sudo apt-get install python-is-python3
4. error: pycocotools/_mask.c: 没有那个文件或目录.
解决方法:
pip install Cython
5. Ubuntu 16安装mmcv-full,报错:
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
解决方法:
export CUDA_HOME=/usr/local/cuda-X.X
6. Can't get attribute 'SiLU' on module 'torch.nn.modules.activation' from 'D:\Anaconda3\envs\虚拟环境名\lib\site-packages\torch\nn\modules\activation.py' .
解决方法:把类SiLu的代码粘贴到activation.py中:
class SiLU(Module): # export-friendly version of nn.SiLU()
@staticmethod
def forward(x):
return x * torch.sigmoid(x)
7. AttributeError: ‘Upsample’ object has no attribute ‘recompute_scale_factor’.
解决方法:修改 D:\Anaconda3\envs\虚拟环境名\lib\site-packages\torch\nn\modules\upsampling.py
def forward(self, input: Tensor) -> Tensor:
return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners)
# return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners, recompute_scale_factor=self.recompute_scale_factor)
8. export failure: Exporting the operator silu to ONNX opset version 12 is not supported. Please open a bug to request ONNX export support for the missing operator.
解决方法:X:\anaconda3\envs\虚拟环境名\Lib\sitepackages\torch\nn\modules\activation.py(此处结合自己的anaconda)
class SiLU(Module):
__constants__ = ['inplace']
inplace: bool
def __init__(self, inplace: bool = False):
super(SiLU, self).__init__()
self.inplace = inplace
def forward(self, input: Tensor) -> Tensor:
# ------------------------------------- #
# 把F.silu替换掉,修改后如下
return input * torch.sigmoid(input)
# 原来的代码
# return F.silu(input, inplace=self.inplace)
9. 使用screen时因CUDA无法调用GPU.
解决方法:可能是会话环境可能改变了环境变量 LD_LIBRARY_PATH。
首先在screen会话外的命令行中确认能运行的环境的LD_LIBRARY_PATH 即:
echo $LD_LIBRARY_PATH
然后进入screen会话中定义该环境变量,即:
export LD_LIBRARY_PATH="PATH",PATH为echo输出的正常变量地址,且虚拟环境名称与会话名称不要一致。