初学的愚蠢错误

虚拟机内的c++找不到头文件

  • Finally Solution:没装g++编译器

Ubuntu Linux MySQL刚安装找不到密码用户名

LINUX:拷贝文件src/指定目录下,文件夹图标上有个叉.更改文件权限可解决该问题。

Ubuntu 20.04 上安装 MySQL

如何在 Ubuntu 20.04 上安装 MySQL

Linux下deb包和rpm包的安装方法

Linux下装vscode

  • sudo apt install g++;
  • sudo apt install make;
  • vscode c++/cmake/插件;

Linux运行MySQL代码找不到头文件mysql.h/mysql,需要安装

  • sudo apt install libmysqlclient-dev;

g++ yes : gcc no

  • image
    shoud compile it with g++ instead of gcc
  • image

Ubuntu安装汉语输入法

sudo apt update
sudo apt upgrade
sudo apt-get update
sudo apt install ibus
sudo reboot
im-config
sudo reboot

Ubuntu app store vscode无法输入中文

在appstore卸载后在官网下载deb版本,后用sudo dpkg -i code_1.76.1-1678294265_amd64.deb

compiling error



最终需要处理的是connect_socket_fd而不是listen_socket_fd;

cfd是用来传输文件的;lfd是用来监听的。各有分工

snprintf(buf,sizeof(buf),format,...);

vmare tools 安装后重启即可在VM与HOST之间复制粘贴

sudo apt-get install open-vm-tools-desktop

py文件导出为exe

你可以使用pyinstaller将python文件打包成一个可执行的exe文件。首先,你需要确保已经安装了pyinstaller模块。如果还没有安装,请在终端中运行以下命令:

pip install pyinstaller

一旦安装了pyinstaller,你可以通过以下步骤来将.py文件打包为.exe文件:

  1. 打开终端并进入.py脚本所在的目录。
  2. 运行以下命令:
pyinstaller --onefile your_script_name.py

在这里,"your_script_name.py" 应替换为要打包的Python脚本的名称。此命令将在同一目录下创建一个名为 "dist" 的文件夹,并在其中生成一个可执行文件。这个可执行文件被打包到一个文件中,名为“your_script_name.exe”。

现在,你可以在任意计算机上双击运行该.exe文件,而不需要安装 Python 环境或其他必需库。

最终exe文件存放在程序所在的文件夹

系统不允许执行powershell脚本

https://learn.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.3

先删除权限设置,删除后变为undefined,后重新对CurrentUser特定范围设置权限

PackagesNotFoundError: The following packages are not available from current channels:- clip

https://blog.csdn.net/weixin_45552562/article/details/109668589
image

git clone

error and solution:
$ cat ~/.gitconfig 发现设置了很多代理

[http "https://github.com"]
        proxy = https://127.0.0.1:1080
[https "https://github.com"]
        proxy = https://127.0.0.1:1080
[http]
        postBuffer = 524288000

用vim进入后全部删除即可

Ubuntu无法连接到git clone

在尝试了很多次子coding和github网站上均无法实现git clone命令时时,确认自己已经在本机上生成了ssh key,也已经将SSH 公钥添加到coding或者是github中,需要注意自己有没有在ubuntu系统中安装ssh服务,以及有没有开启SSH服务。

输入 $ ssh localhost

显示:ssh: connect to host localhost port 22: Connection refused 表示没有安装ssh server,通过如下命令安装

$ sudo apt-get install openssh-server

安装完成后启动服务

$ sudo /etc/init.d/ssh start

然后进行git clone 就可以了
————————————————
版权声明:本文为CSDN博主「张叫张大卫」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_40100431/article/details/79965424

ROS安装


Noetic Ninjemys对应Ubuntu20.04(ROS1)
ROS Iron Irwini对应22.04(ROS2)

import cv2报错ImportError: libGL.so.1: cannot open shared object file: No such file or directory

pip install opencv-python-headless
#https://blog.csdn.net/qq_50195602/article/details/124188467

添加tsinghua源

pip install http://pypi.tuna.tsinghua.edu.cn/simple opencv-python-headless

预训练模型需要联网下载但服务器没网

clip模型

#     # loading models
#     device = "cuda" if torch.cuda.is_available() else "cpu"
#     # device ="cpu"
#     print(device)

#     # 选择生成特征向量维度,特征向量的维度为512维(ViT-B/32和ViT-B/16,clip_feat_dim都会=512维)。此维度用于计算图像与文本之间的相似性得分。
#     clip_version = "ViT-B/32"
#     clip_feat_dim = {'RN50': 1024, 'RN101': 512, 'RN50x4': 640, 'RN50x16': 768,
#                     'RN50x64': 1024, 'ViT-B/32': 512, 'ViT-B/16': 512, 'ViT-L/14': 768}[clip_version]
#     print("Loading CLIP model...")
#     clip_model, preprocess = clip.load(clip_version)  # clip.available_models()
#     clip_model.to(device).eval()

改为👇加载本地模型(.pt文件):

    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    print(f"device:{device}")
    clip_version = "ViT-B/32"
    clip_feat_dim = {'RN50': 1024, 'RN101': 512, 'RN50x4': 640, 'RN50x16': 768,
                    'RN50x64': 1024, 'ViT-B/32': 512, 'ViT-B/16': 512, 'ViT-L/14': 768}[clip_version]
    clip_model = torch.jit.load("./ViT-B-32.pt")
    clip_model.to(device).eval()

LSeg模型

LSeg_block模块中更改pretrainmodel=Flase;
LSeg_vit模块中的_make_pretrained_clip_vitl16_384()函数中

clip_pretrained, _ = clip.load("ViT-B/32", device="cuda", jit=False)

改为上面的 clip_model = torch.jit.load("./ViT-B-32.pt")加载本地

timm

timm库是pytorch常用模型的下载库,首次下载需要联网

报错no module named timm.layers
pip install --upgrade timm
LSeg网络加载问题

在LSegEnCode类中直接加载本地的.pth文件
image
在源代码中删除赋予checkpoints的部分
image

rgb_list = sorted,Linux与Win11检查不同,在Linux中第一种强制类型转换会报错


#Traceback (most recent call last):
#  File "localroom_origin.py", line 403, in <module>
#    create_lseg_map_batch(data_dir, camera_height=camera_height, cs=cs, gs=gs, depth_sample_rate=depth_sample_rate)
#  File "localroom_origin.py", line 139, in create_lseg_map_batch
#    rgb_list = sorted(os.listdir(rgb_dir), key=lambda x: int(
#  File "localroom_origin.py", line 139, in <lambda>
#    rgb_list = sorted(os.listdir(rgb_dir), key=lambda x: int(
#ValueError: invalid literal for int() with base 10: 'checkpoints'
     # -1表示分割后的最后一个元素;0表示分割后的第一个元素
    rgb_list = sorted(os.listdir(rgb_dir), key=lambda x: int(
        x.split("_")[-1].split(".")[0]))

    rgb_list = sorted(
        [name for name in os.listdir(rgb_dir) if name.split("_")[-1].split(".")[0].isdigit()],
        key=lambda x: int(x.split("_")[-1].split(".")[0])
    )

habitat sim安装

image

不同目录的引用

raw.githubusercontent.com port 443: 拒绝连接

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
curl: (7) Failed to connect to raw.githubusercontent.com port 443: 拒绝连接

解决办法,配置ip-hosts name
image

如何在jupyter notebook中使用conda的虚拟环境

conda install -c anaconda ipykernel
python -m ipykernel install --user --name=my_env

虽然这个函数写的是返回5个值,但打印出来只有4个

ros install中libqt依赖问题

https://answers.ros.org/question/402781/ros-humble-ubuntu-2204-apt-install-issue/

$ sudo aptitude install ros-humble-desktop
#The following packages have unmet dependencies:
#
# ros-humble-desktop : Depends: ros-humble-action-tutorials-cpp but it is not installable
#      <Dependencies listed>
#
#The following actions will resolve these dependencies:
#
#     Keep the following packages at their current version:
#
#         ros-humble-desktop [Not Installed]
Type: N
Type: Y
Type: Y

'Some dependencies are not installed, and the previously installed versions of the dependencies are not correct, some require downgrade, and some require upgrade

Install environment
Use the original sources.list: dep http://ports.ubuntu.com/bionic main res...

Other sources.list: ustc, tuna... have not been tested

Solution

Install aptitude

sudo apt-get install aptitude
2.Install ros-melodic-desktop-full with aptitude

sudo aptitude install ros-melodic-desktop-full
3.The first prompt reminds us that there are a lot of things that are not installed, about 100-600, let us choose to keep the original ones, but there is no at all, enter n here

4.The second prompt may ask us to upgrade or downgrade something, this is what we need, choose Y

5.Select Y to install

6.After that, “-O APT:::GET::Fix-Missing=true” may appear, execute: sudo apt-get --fix-missing
https://img2023.cnblogs.com/blog/3126982/202310/3126982-20231023132444084-1769314770.png
7.Repeat a few times from step 1-6, each time you will find that things you need to install will be reduced a lot, and finally, if you have no problem after step 6, it will automatically install ros.

It works for me'

ros domain-id=222

使用isaac sim

问题

通过sim内平台可以运行,打印出来的sys.executable也是和我vscode设置的python解释器一样,可导入的包就是报错找不到。

解决办法

查看各个包的位置手动导入

spec = importlib.util.find_spec("omni.ext")
spec1 = importlib.util.find_spec("omni.physx")
spec2 = importlib.util.find_spec("carb")
print('***************************3',spec.origin,spec1.origin,spec2.origin)

???

应该有更聪明点的办法?

jupyter slider show

conda install -c conda-forge notebook
conda install -c conda-forge rise
conda install -c conda-forge ipykernel
python -m ipykernel install --user --name=vima(my conda env name)

VIMA

ven = NVIDIA Corporation
Traceback (most recent call last):
  File "/home/yide/VIMA/scripts/example.py", line 522, in <module>
    main(arg)
  File "/home/yide/anaconda3/envs/VM2/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/yide/VIMA/scripts/example.py", line 246, in main
    obs,reward,terminated,info_dict = env.step(actions)
  File "/home/yide/anaconda3/envs/VM2/lib/python3.10/site-packages/gym/wrappers/time_limit.py", line 50, in step
    observation, reward, terminated, truncated, info = self.env.step(action)
ValueError: not enough values to unpack (expected 5, got 4) 

这个函数原来写的是

observation, reward, terminated,truncated,info= self.env.step(action)
但是我打印 self.env.step(action)输出只有四个,上面的最后两项合并为一个info_dict了

omniverse启动卡在登录界面

https://docs.omniverse.nvidia.com/platform/latest/common/technical-requirements.html

I solved the issue by looking for the “nvidia-omniverse-launcher.desktop” file and copying it into the directory mentioned by the error (“/home/user/.config/autostart/”).
I hope this helps.

omniverse

@property函数表示可以直接写函数名来调用函数不需要括号

git clone某仓库的子文件夹

ubuntu22.04 installl rvm ruby

refer:https://blog.csdn.net/Qudoudou2020/article/details/133968423
2.7装不了,只能装3.

udo apt update            (更新软件包列表)
sudo apt install software-properties-common    (安装第三方库支持)
sudo apt-add-repository ppa:rael-gc/rvm     (添加rvm源)
sudo apt update           (更新软件包列表)

sudo apt install rvm
sudo usermod -a -G rvm <yourusername>



重启系统

rvm install <Ruby版本号>
rvm use <Ruby版本号> --default

clash for linux 安装和自主选择(UI)

https://w1.v2free.cyou/doc/#/linux/clash





linux 解压缩

tar zxvf pythontab.tar.gz  tar  -zxvf  fenci.py.tar.gz  -C  pythontab/       
or
gzip -d pythontab.gz
posted @ 2023-03-09 08:35  Logic_Han  阅读(225)  评论(0编辑  收藏  举报