当前位置: 首页 > news >正文

网站开发需求说明书模板短视频运营是做什么的

网站开发需求说明书模板,短视频运营是做什么的,乐清本地网,描述对于营销型网站建设很重要飘红效果更佳【ROS】ros-noetic和anaconda联合使用 文章目录 【ROS】ros-noetic和anaconda联合使用1. 安装anaconda2. 创建虚拟环境3. 查看python解释器路径4. 在虚拟环境中使用任意的包5. 创建工作空间和ros功能包进行测试Reference 1. 安装anaconda 在Ubuntu20.04中安装anaconda可以参考…

【ROS】ros-noetic和anaconda联合使用

文章目录

  • 【ROS】ros-noetic和anaconda联合使用
    • 1. 安装anaconda
    • 2. 创建虚拟环境
    • 3. 查看python解释器路径
    • 4. 在虚拟环境中使用任意的包
    • 5. 创建工作空间和ros功能包进行测试
    • Reference

1. 安装anaconda

在Ubuntu20.04中安装anaconda可以参考博主的这篇博客,这里就不再赘述。下面简要介绍下博主使用的环境

2. 创建虚拟环境

Anaconda基本环境管理语法如下

  • 创建虚拟环境
conda create -n <your-virtualenv-name> python=3.8
  • 激活虚拟环境
conda activate <your-virtualenv-name>

激活虚拟环境后使用pip install rospkg rospy catkin_tools来安装ros依赖

#in your virtual env
pip install rospkg rospy catkin_tools

3. 查看python解释器路径

笔者使用的是ros-noetic版本,安装的anaconda3,在ros-noetic中的原生python版本为python3.8.10,如果使用的ros-melodic版本,那么原生python应该三是python2.7

下面我们验证一下基本信息是否正确,打开一个terminal

which python3
Image

默认的python3解释器路径是/usr/bin/python3

然后,查看anaconda虚拟环境中的python3解释器路径

conda activate <your_virtualenv_name>
which python3

比如笔者的虚拟环境名字是metaRL,查看的结果如下

Image

4. 在虚拟环境中使用任意的包

笔者在这个环境中配置了torch-v2.0.1具体教程参考这篇博客,这个所需要的包可以是任何你想使用的包。我们验证一下是否能顺利导入

conda activate <your_virtualenv_name>
python
import rospy
print(rospy.__file__)
import torch
print(torch.__file__)

如下所示,我们顺利导入了rospytorch并且查看了其存放路径

Image

5. 创建工作空间和ros功能包进行测试

mkdir -p ~/test_ws/src
cd ~/test_ws/src/
catkin_init_workspace
catkin_create_pkg test_ros_python std_msgs rospy
cd ..
catkin_make
echo "source ~/test_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

然后创建一个测试脚本

roscd test_ros_python
mkdir scripts
touch test_node.py
chmod +x test_node.py

然后在test_node中编写以下内容

#! /usr/bin/env python
# coding :utf-8print('\n*****************************************\n\t[test libraries]:\n')
import rospy
import torchprint(' - rospy.__file__ = %s'%rospy.__file__)
print(' - scipy.__file__ = %s'%torch.__file__)
# check cuda is ready or not
print('cuda is {}'.format('ready' if torch.cuda.is_available() else 'not ready'))
print('\n*****************************************\n\t[finish test]\n')if __name__ == "__main__":rospy.init_node('test_node', anonymous=True)rospy.loginfo('>>>>> hello world >>>>>')

这样进行测试之后发现,并不能顺利导入我所需要的torch包,如下图所示

Image

这个结果与我们之前在终端中的结果相违背,那么可以详细查看一下python包的搜索路径,利用sys

#! /usr/bin/env python
# coding :utf-8print('\n*****************************************\n\t[test libraries]:\n')
import rospy
import sys
for p in sys.path:print(p)# print()
# import torchprint(' - rospy.__file__ = %s'%rospy.__file__)
# print(' - scipy.__file__ = %s'%torch.__file__)
# # check cuda is ready or not
# print('cuda is {}'.format('ready' if torch.cuda.is_available() else 'not ready'))
print('\n*****************************************\n\t[finish test]\n')if __name__ == "__main__":rospy.init_node('test_node', anonymous=True)rospy.loginfo('>>>>> hello world >>>>>')

查看的搜索路径如下

Image

奇怪的是这里并没有我们之前在终端中得到的路径

Image

我们可以手动将这个路径添加到python的搜索路径当中

/home/<your-user-name>/anaconda3/envs/<your-virturalenv-name>/lib/python3.8/site-packages

得到如下的脚本文件

#! /usr/bin/env python
# coding :utf-8print('\n*****************************************\n\t[test libraries]:\n')
import rospy
import sys
sys.path.append('/home/sjh/anaconda3/envs/metaRL/lib/python3.8/site-packages')
for p in sys.path:print(p)print()
import torchprint(' - rospy.__file__ = %s'%rospy.__file__)
print(' - scipy.__file__ = %s'%torch.__file__)
# check cuda is ready or not
print('cuda is {}'.format('ready' if torch.cuda.is_available() else 'not ready'))
print('\n*****************************************\n\t[finish test]\n')if __name__ == "__main__":rospy.init_node('test_node', anonymous=True)rospy.loginfo('>>>>> hello world >>>>>')

成功导入了torch

Image

Reference

【Linux】Ubuntu20.04版本配置pytorch环境2023.09.05【教程】

【ROS】如何在ROS中使用anaconda虚拟环境?

ROS图像的Deeplab v3+实时语义分割(ROS+Pytorch)

http://www.shuangfujiaoyu.com/news/61804.html

相关文章:

  • org后缀做网站行网页设计制作网站
  • html欧美网站模板汕头网站建设方案推广
  • 公司网站手机版模板绍兴seo排名外包
  • 黄岛开发区做网站的公司百度seo提高排名费用
  • DW怎么做网站下拉菜单网站关键词seo费用
  • paypal网站集成网站推广培训
  • 做网站策划遇到的问题太原搜索排名提升
  • 大连网站建设好的公司外贸独立站推广
  • 萧山好的做网站的公司什么是电商?电商怎么做
  • 怎么判断网站优化过度网络营销推广专家
  • 一个企业该如何进行网络营销seo顾问赚钱吗
  • 中职学校网站建设的厂家无货源电商怎么做
  • 在线网站制作平台seo短期课程
  • 互联网推广销售是做什么的兰州seo优化公司
  • 网站做链接的意义是什么营销型网站建设步骤
  • 网站建设功能模块图沈阳专业网站seo推广
  • 网站建设价格费用博为峰软件测试培训学费
  • wordpress新建菜单设置安卓优化大师旧版本
  • 深圳市建设科技促进中心网站网页设计用什么软件做
  • 专门做母婴的网站有哪些黑帽seo365t技术
  • 衡水电子商务网站建设公司网页设计
  • dede电影网站源码培训心得体会1000字
  • 最新某地方装修门户源码 php装饰公司程序 dede行业网站模板优化营商环境心得体会
  • 网站建设介绍ppt英语seo什么意思
  • 揭秘低价网站建设危害百度地图在线查询
  • 网站备案类型今日油价92汽油价格调整最新消息
  • 做淘宝客网站需要多大带宽适合交换友情链接的是
  • 网站开发最好用什么软件seo网站优化快速排名软件
  • 免费的网站发布seo外链发布工具
  • 创办网站需要哪些步骤关键词推广营销