一、Win11(PowerShell与Cmd搭配)
1.1 安装 Chocolatey
是Windows平台上的包管理器,通过它可以集中安装、管理、更新各种各样的软件。
是和apt-get,brew差不都的一个东西。
在PowerShell(管理员)
中输入:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
测试是否安装成功:
choco –version
1.2 安装 Python 3.8.3
choco install -y python --version 3.8.3
1.3 安装 Visual C++ Redistributables
choco install -y vcredist2013 vcredist140
1.4 安装 Win64 OpenSSL v1.1.1
这里安装 Win64 OpenSSL v1.1.1,傻瓜式一路向北。
配置环境变量:
(1)先在cmd
中:
setx /m OPENSSL_CONF "C:\Program Files\OpenSSL-Win64\bin\openssl.cfg"
(2)然后手动添加至PATH
:
C:\Program Files\OpenSSL-Win64\bin\
1.5 安装 VS2022
安装C++部分
1.6 安装 OpenCV 3.4.6
这里安装 OpenCV 3.4.6
配置环境变量:
(1)先在cmd
中:
setx /m OpenCV_DIR 路径\opencv"
(2)然后手动添加至PATH
:
路径\opencv\x64\vc16\bin
1.7 安装依赖
1.7.1 cmake
choco install -y cmake
1.7.2 dependencies
将dependencies全部包下载安装到ROS2\dependencies
路径后,
choco install -y -s C:\Users\11814\Software\ROS2\dependencies\ asio cunit eigen tinyxml-usestl tinyxm2 bullet
python -m pip install -U pip setuptools==59.6.0
python -m pip install -U catkin_pkg cryptography empy importlib-metadata lark==1.1.1 lxml matplotlib netifaces numpy opencv-python PyQt5 pillow psutil pycairo pydot pyparsing==2.4.7 pyyaml rosdistro
1.8 安装 Qt5
在这里下载Qt5,选择5.12.x Offline Installers
下的Qt 5.12.12 for Windows
。
安装过程中在select components 这一步选择
Qt:MSVC 2017 64-bit
Developer and Designer Tools:Qt Creator
与MinGW 7.3.0 64-bit
安装完成后配置环境变量:
配置环境变量:
在cmd
中:
setx /m Qt5_DIR 路径\5.12.12\msvc2017_64
setx /m QT_QPA_PLATFORM_PLUGIN_PATH 路径\5.12.12\msvc2017_64\plugins\platforms
1.9 安装 ROS2
在这里获取
解压后在cmd
call C:\opt\ros\foxy\x64\local_setup.bat
测试小海龟
ros2 run turtlesim turtlesim_node
如果报错'package'module没找到,则需要配置ROS2的环境:
- 新建指令文件
C:\Users\你的名字\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
内容:
路径\humble\local_setup.ps1
Unblock-File 路径\humble\local_setup.ps1
2. 在搜索栏中搜索windows PowerShell ISE
输入:
set-ExecutionPolicy RemoteSigned
1.10 安装Colcon
pip install -U colcon-common-extensions