Jeston nano使用问题记录

学习记录

查找PATH路径下配置的文件

$ which python3.8
/usr/bin/python3.8

查看某个软件路径

# 默认情况下,rpm和二进制包的可执行文件安装到/usr/bin下,源码包的可执行文件安装到/usr/local/bin下。
#display the location of the executable file(显示可执行文件的位置)
which software_name
whereis software_name
# 显示和该软件有关的所有文件的位置
locate software_name
# 可执行文件的路径必须在环境变量PATH中,才可以用命令搜索到可执行文件。

查看某个库的路径

ldconfig -p | grep name

强制修改分辨率

xrandr --fb 1024x768

jeston nano设置开机启动任务,修改远程桌面分辨率

查找OpenCV路径

sudo find / -iname "*opencv*"

查看pip的所有包

pip list

setup.py安装python库

python setup.py build
python setup.py install

如果权限不够,加sudo

卸载setup.py安装的库

//增加 –record 参数重新安装软件包,执行命令:
python ./setup.py install --record install.txt

//删除安装文件,执行命令:
cat install.txt | xargs rm -rf

查看文件层次结构

tree dirname

Git下载

git clone git@github.com:jpivarski/svgfig.git

pip的使用

python -m pip install XXX

终端隐藏输出

> /dev/null
表示把标准输出重定向到/dev/null,也就是不在屏幕上输出标准输出
>& /dev/null
表示把标准输出和错误输出重定向到/dev/null,程序不在屏幕上输出
2>/dev/nul
2表示标准错误,将标准错误重定向到空设备里,即不输出错误信息
>/dev/null 2>&1
默认情况是1,也就是等同于1>/dev/null 2>&1。意思就是把标准输出重定向到“黑洞”,还把错误输出2重定向到标准输出1,也就是标准输出和错误输出都进了“黑洞”
2>&1 >/dev/null
意思就是把错误输出2重定向到标准出书1,也就是屏幕,标准输出进了“黑洞”,也就是标准输出进了黑洞,错误输出打印到屏幕
cat /dev/null > /home/omc/h.txt
清空文件/home/omc/h.txt
/dev/zero
当使用或者读取的时候,提供无限连续不断的空的数据流

  1. 覆盖其他的文件信息
  2. 产生指定大小的空文件,如交换文件,模拟虚拟文件系统

>/dev/null 2>&1 VS >/dev/null 2>/dev/null

不用>/dev/null 2>/dev/null重复,用重定向绑定原因,
将标准输出和错误输出都定向到out文件中
在这里插入图片描述

出现了乱码。这是因为采用这种写法,标准输出和错误输出会抢占往out文件的管道,所以可能会导致输出内容的时候出现缺失、覆盖等情况。有时候不出现乱码,可能出现只有error信息或者只有正常信息的情况。最后的情况是无法预估的。
而且,由于out文件被打开了两次,两个文件描述符会抢占性的往文件中输出内容,所以整体IO效率不如>/dev/null 2>&1来得高。

参考:linux中>/dev/null 2>&1和2>&1 > /dev/null

nohup

使用nohup command &命令形式来启动一些后台程序,比如一些java服务:
在这里插入图片描述
为了不让一些执行信息输出到前台(控制台),加上刚才提到的>/dev/null 2>&1命令来丢弃所有的输出:
在这里插入图片描述

文件描述符

类型文件描述符默认情况对应文件句柄位置
标准输入(standard input)0从键盘获得输入/proc/slef/fd/0
标准输出(standard output)1输出到屏幕(即控制台)/proc/slef/fd/1
错误输出(error output)2输出到屏幕(即控制台)/proc/slef/fd/2

输出重定向

命令介绍
command >filename把标准输出重定向到新文件中
command 1>filename同上
command >>filename把标准输出追加到文件中
command 1>>filename同上
command 2>filename把标准错误重定向到新文件中
command 2>>filename把标准错误追加到新文件中

输入重定向

命令介绍
command <filename以filename文件作为标准输入
command 0<filename同上
command <<delimiter从标准输入中读入,直到遇到delimiter分隔符

cat结合重定向

如果cat后面没有跟文件名的话,那它的作用就是将标准输入(比如键盘)回显到标准输出(比如屏幕)上
在这里插入图片描述

可以将利用输入重定向,将我们在键盘上敲入的字符写入到文件中。使用ctrl+c来结束输入
在这里插入图片描述
让cat读取一个文件
在这里插入图片描述
使用分隔符,输入完cat >out <<end,然后敲下回车之后,命令并没有结束,此时cat命令像一开始一样,等待输入数据。然后当我们敲入end之后,cat命令就结束了。end之前输入的字符都已经被写入到了out文件中。这就是输入分割符的作用。
在这里插入图片描述

ls可以连续使用

例如
ls dirname1 dirname2

python3.6升级到3.8

查当前python3版本

$ python3 -V

安装python3.8

$ sudo apt-get install python3.8

查看python3.8版本

$ python3.8 -V

将 python 各版本添加到 update-alternatives

$ which python3.8
/usr/bin/python3.8

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

$ which python3.6
/usr/bin/python3.6

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

配置 python3 默认指向 python3.8

$ sudo update-alternatives --config python3

There are 2 choices for the alternative python3 (providing /usr/bin/python3).

 Selection Path  Priority Status
------------------------------------------------------------
* 0  /usr/bin/python3.6 2  auto mode
 1  /usr/bin/python3.6 2  manual mode
 2  /usr/bin/python3.8 1  manual mode

Press <enter> to keep the current choice[*], or type selection number: 2

选择/输入 2, 回车。

测试 python 版本

$ python3 -V

Python 3.8.2

参考:将 Ubuntu 16 和 18 上的 python 升级到最新 python3.8 的方法教程

更新python3后pip报错

Traceback (most recent call last):
  File "/home/jetson/.local/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal'

把第六句改成第五句

  5 from pip import main
  6 # from pip._internal.cli.main import main

参考:ModuleNotFoundError: No module named ‘pip._internal’ , pip 无法下载软件 解决办法

继上一个问题以后pip无法使用

jetson@jetson-desktop:~/Project/yolov5$ pip3 install -r requirements.txt
Collecting matplotlib>=3.2.2 (from -r requirements.txt (line 4))
  Using cached https://files.pythonhosted.org/packages/60/d3/286925802edaeb0b8834425ad97c9564ff679eb4208a184533969aa5fc29/matplotlib-3.4.2.tar.gz
    Complete output from command python setup.py egg_info:
    Processing numpy/random/_bounded_integers.pxd.in
    Processing numpy/random/_philox.pyx
    Traceback (most recent call last):
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/tools/cythonize.py", line 59, in process_pyx
        from Cython.Compiler.Version import version as cython_version
    ModuleNotFoundError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/tools/cythonize.py", line 235, in <module>
        main()
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/tools/cythonize.py", line 231, in main
        find_process_files(root_dir)
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/tools/cythonize.py", line 222, in find_process_files
        process(root_dir, fromfile, tofile, function, hash_db)
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/tools/cythonize.py", line 188, in process
        processor_function(fromfile, tofile)
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/tools/cythonize.py", line 64, in process_pyx
        raise OSError('Cython needs to be installed in Python as a module')
    OSError: Cython needs to be installed in Python as a module
    Running from numpy source directory.
    /tmp/easy_install-h4n1z_on/numpy-1.20.2/setup.py:485: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/setup.py", line 513, in <module>
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/setup.py", line 493, in setup_package
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/setup.py", line 290, in generate_cython
    
    RuntimeError: Running cythonize failed!
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-5wp9jb2e/matplotlib/setup.py", line 258, in <module>
        setup(  # Finally, pass this all along to distutils to do the heavy lifting.
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 128, in setup
        _install_setup_requires(attrs)
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 123, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 510, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 772, in resolve
        dist = best[req.key] = env.best_match(
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1057, in best_match
        return self.obtain(req, installer)
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1069, in obtain
        return installer(requirement)
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 580, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 698, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 724, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 909, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1177, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1163, in run_setup
        run_setup(setup_script, args)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/setup.py", line 513, in <module>
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/setup.py", line 493, in setup_package
      File "/tmp/easy_install-h4n1z_on/numpy-1.20.2/setup.py", line 290, in generate_cython
    
    RuntimeError: Running cythonize failed!
    
    Edit setup.cfg to change the build options; suppress output with --quiet.
    
    BUILDING MATPLOTLIB
      matplotlib: yes [3.4.2]
          python: yes [3.8.0 (default, Feb 25 2021, 22:10:10)  [GCC 8.4.0]]
        platform: yes [linux]
           tests: no  [skipping due to configuration]
          macosx: no  [Mac OS-X only]
    
    Cythonizing sources
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5wp9jb2e/matplotlib/

pip3 install --upgrade pip

参考:Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-*解决办法

继更新python3.8

更新python3.8以后,原本的库好像都没了,需要重新pip

查看python指向

ls -l /usr/bin | grep python

ubuntu安装python3.7,并更新python默认指向为python3.7

fatal error: Python.h: No such file or directory

sudo apt-get install python3.6-dev

安装python-dev
Ubuntu下 fatal error: Python.h: No such file or directory 解决方法

Matplotlib created a temporary config/cache directory at XXX

Matplotlib created a temporary config/cache directory at /tmp/matplotlib-6_t_rl47 because the default path (/home/jetson/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
sudo chmod 777 -R matplotlib/

YOLOv5 运行detect程序后的问题

Fusing layers... 
OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option.
。。。。。。
Model Summary: 224 layers, 7266973 parameters, 0 gradients
OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option.
。。。。。。

开机自动打开串口权限

https://blog.csdn.net/ManWZD/article/details/102749906

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值