[英]ROS installation: no such file or directory
According to ros wiki, to set up environment, I typed根据ros wiki,设置环境,我输入
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
The error is错误是
/opt/ros/kinetic/setup.bash:.:8: no such file or directory: /home/pikashun/setup.sh
In ~/.bashrc
file, there is the source /opt/ros/kinetic/setup.bash
line.在~/.bashrc
文件中, source /opt/ros/kinetic/setup.bash
行。
I use Ubuntu on WSL.我在 WSL 上使用 Ubuntu。 How can I improve?我该如何改进?
Thank you!谢谢!
I had the exact same issue.我有完全相同的问题。 The problem is not due to setup.bash
either ~/.bashrc
but the shell that you are using.问题不是由于setup.bash
也不是~/.bashrc
而是您正在使用的 shell。 It turned out that you may be using a different shell than bash
(ie, zsh
).事实证明,您使用的 shell 可能与bash
不同(即zsh
)。 When you are executing the setup.bash
of ROS, zsh
interprets the following command (whici is in /opt/ros/kinetic/setup.bash
) differently:当您执行 ROS 的setup.bash
时, zsh
对以下命令(其在/opt/ros/kinetic/setup.bash
)的解释不同:
_CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)
It is setting the _CATKIN_SETUP_DIR
to your user directory.它将_CATKIN_SETUP_DIR
设置为您的用户目录。 That is why you are getting error, cause you using the wrong path: /home/user/setup.bash
instead of /opt/ros/kinetic/setup.bash
这就是为什么你会出错,导致你使用错误的路径: /home/user/setup.bash
而不是/opt/ros/kinetic/setup.bash
To check whether this is the issue of your problem, you can check the shell that you are using by execute the following in the terminal:要检查这是否是您的问题,您可以通过在终端中执行以下命令来检查您正在使用的 shell:
echo $0; echo $SHELL
It may return something like:它可能会返回如下内容:
zsh
/bin/zsh
To switch from zsh
to bash
, use:要从zsh
切换到bash
,请使用:
exec bash
Once done this, you can use source without any problem.完成此操作后,您可以毫无问题地使用源代码。
And to switch back to your previous shell (assuming that is zsh
), just use:并切换回之前的 shell(假设是zsh
),只需使用:
exec zsh
The file /opt/ros/kinetic/setup.bash
does nothing but loading /opt/ros/kinetic/setup.sh
from the same directory.文件/opt/ros/kinetic/setup.bash
除了从同一目录加载/opt/ros/kinetic/setup.sh
/opt/ros/kinetic/setup.bash
什么/opt/ros/kinetic/setup.bash
做。 I might be that you are not running bash
( check which terminal you run ), or that WSL has some different behavoiour than expected.我可能是您没有运行bash
( 检查您运行的是哪个终端),或者 WSL 的行为与预期不同。 However, your can just alter your append command like so:但是,您可以像这样更改您的 append 命令:
echo "source /opt/ros/kinetic/setup.sh" >> ~/.bashrc
or in your case, since the entry exists already in your ~/.bashrc
, edit the line source /opt/ros/kinetic/setup.bash
to source /opt/ros/kinetic/setup.sh
或者在您的情况下,由于条目已经存在于您的~/.bashrc
,请编辑行source /opt/ros/kinetic/setup.bash
到source /opt/ros/kinetic/setup.sh
The packages or files were not actually downloaded from the " http://wiki.ros.org/melodic/Installation/Ubuntu ".这些包或文件实际上并不是从“ http://wiki.ros.org/melodic/Installation/Ubuntu ”下载的。 To overcome this error first open terminal要克服这个错误首先打开终端
check your directory pwd
.检查您的目录pwd
。 If your directory is like /home/'Your PC Name' it won't actually work.如果您的目录类似于 /home/'Your PC Name' 它实际上将不起作用。
Change the directory : Type cd /
更改目录:键入cd /
Continue the installation process from start which mentioned in " http://wiki.ros.org/melodic/Installation/Ubuntu "从“ http://wiki.ros.org/melodic/Installation/Ubuntu ”中提到的开始继续安装过程
melodic can change to kinetic or other version if you wish如果您愿意,旋律可以更改为动力学或其他版本
have you installed kinetic ?你安装了 kinetic 吗? you could check the path by你可以检查路径
/opt/ros/kinetic
do you see setup.bash你看到 setup.bash 了吗
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.