Ubuntu操作遇到的报错解决方法汇总(持续更新)

1、在anaconda中创建了虚拟环境并安装了pytorch,但是编译过程中仍然报没有torch的错误:

CMake Error at crawler_crane/crane_tutorials/CMakeLists.txt:23 (find_package):
  By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Torch", but
  CMake did not find one.

  Could not find a package configuration file provided by "Torch" with any of
  the following names:

    TorchConfig.cmake
    torch-config.cmake

  Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
  "Torch_DIR" to a directory containing one of the above files.  If "Torch"
  provides a separate development package or SDK, be sure it has been
  installed.

解决方法:在隐藏文件 .bashrc 中添加以下语句:

export Torch_DIR="/home/kieran/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/share/cmake"

2、error: #error C++14 or later compatible compiler is required to use ATen.
#error You need C++14 to compile PyTorch
这个错误搜到了几种不同的解决方式:

   //方式一:在CMakeLists.txt文件中加入以下内容
    ADD_COMPILE_OPTIONS(-std=c++11 )
    ADD_COMPILE_OPTIONS(-std=c++14 )
    set( CMAKE_CXX_FLAGS "-std=c++11 -O3" )
    //方式二:在CMakeLists.txt文件中加入以下内容
    add_compile_options(-std=c++11)
    add_compile_options(-std=c++14)
    set( CMAKE_CXX_STANDARD 14)

3、Anaconda中激活删除环境

conda create -n torch python=3.6 //用来创建新的虚拟环境
conda remove -n torch1 --all  //用来删除anaconda中的环境
conda config --set auto_activate_base false //解决默认进入虚拟环境
which python //用来查看python安装路径,应用于多版本python调用对照 
python --version //用来查看python对应版本

4、 (1)Failed to load rear_right_velocity_controller:
(2)Could not load controller ‘left_front_wheel_velocity_controller’ because controller type ‘effort_controllers/JointVelocityController’ does not exit::

sudo apt-get install ros-melodic-velocity-controllers

sudo apt-get install ros-melodic-effort-controllers

5、Could not find SDL_image(missing:SDL_IMAGE_LABRARIESSDL_IMAGE_INCLUDE_DIRS)

sudo apt-get install libsdl-image1.2-dev

6、Could not find SDL(missing:SDL_LIBRARY SDL_INCLUDE_DIR)

sudo apt-get install libsdl-dev 或 sudo apt-get install libsdl1.2-dev

7、ModuleNotFoundError:No module named ‘rospkg’:安装rospkg即可
8、ImportError:dynamic module does not define module export function(PyIntit__tf2):解决方法如下:

修改解释器为python2.7即可解决  #! /usr/bin/env python2.7

9、解决ROS中运行gazebo出现process has died的情况

killall gzserver

10、cc:50:10: fatal error: pcap.h: 没有那个文件或目录

解决方法:sudo apt-get install libpcap-dev

11、ERROR: cannot launch node of type [map_server/map_server]: map_server

sudo apt-get install ros-melodic-map-server
//下面还有一些类似的报错及安装包:
1、sudo apt-get install ros-melodic-tf2-sensor-msgs
2、sudo apt-get install ros-melodic-move-base-msgs
3、sudo apt-get install ros-melodic-serial
4、sudo apt-get install ros-melodic-geographic-msgs
5、sudo apt-get install ros-melodic-base-local-planner
6、sudo apt-get install ros-melodic-costmap-converter
7、sudo apt-get install ros-melodic-mbf-costmap-core
8、sudo apt-get install ros-melodic-mbf-msgs
9、sudo apt install ros-melodic-gmapping
10、sudo apt-get install ros-melodic-move-base

12、Unable to find SuiteSparse
Call Stack (most recent call first):
teb_local_planner/CMakeLists.txt:35 (find_package)

解决方法:sudo apt-get install libsuitesparse-dev

13、 Could not find libg2o!

解决方法:sudo apt-get install ros-melodic-libg2o

14、ERROR: cannot launch node of type [swri_transform_util/initialize_origin.py]: swri_transform_util

sudo apt-get install ros-melodic-mapviz ros-melodic-mapviz-plugins ros-melodic-tile-map ros-melodic-multires-image

你可能感兴趣的:(Ubuntu,1024程序员节,ubuntu,linux)