Ubuntu环境配置

Ubuntu 环境配置相关问题

目录:

  • Ubuntu ibus输入法无法按数字键取词问题
  • GitHub 添加ssh密钥
  • Anaconda配置
  • GRUB2引导顺序调整
  • gcc版本降级
  • GPG error: The following signatures couldn’t be verified because the public key is not available.

Ubuntu ibus输入法无法按数字键取词问题

参考:

ubuntu自带输入法ibus 无法按数字键取词

操作系统:Ubuntu 18.04

rm -rf ~/.cache/ibus/libpinyin 有个人习惯词先备份user_bigram.db 重启 ibus restart

GitHub 添加ssh密钥

  • 生成ssh key

    • 1
      $ ssh-keygen -t rsa -C "you@example.com"
      
  • 密钥存储位置: ~/.ssh/id_rsa.pub

  • GitHub上添加密钥

Anaconda配置

安装
1
$ bash Anaconda3-2020.02-Linux-x86_64.sh
anaconda自动进入虚拟环境base
  • 解决方法:

    1
    $ conda config --set auto_activate_base false
    
创建虚拟环境失败(代理问题):
  • 解决方法;

    • 向 ~/.bashrc 中添加:

      1
      $ export all_proxy="socks5://127.0.0.1:1080"
      
创建虚拟环境
  • 注意要写明python版本,否则虚拟环境中没有python
1
$ conda create -n <env-name> python=3.7
conda安装opencv
1
$ conda install -c menpo opencv

或者

1
$ conda install py-opencv
虚拟环境中调用opencv-python报错:error: (-2:Unspecified error) The function is not implemented.
  • 1
    $ conda uninstall py-opencv
    
  • PYPI官网下载适当版本的opencv,此处为

    • opencv_python-4.3.0.36-cp37-cp37m-manylinux2014_x86_64.whl
  • 1
    $ pip3 install opencv_python-4.3.0.36-cp37-cp37m-manylinux2014_x86_64.whl
    
虚拟环境中使用 pip3 install 报错:Missing dependencies for SOCKS support
  • 1
    $ conda install pysocks
    

GRUB2引导顺序调整

  • 修改 /etc/default/grub 中的 GRUB_DEFAULT

  • 使用以下命令更新菜单

    • 1
      $ sudo update-grub2
      

gcc版本降级

  • Ubuntu20.04自带gcc版本为gcc9,但CUDA编程需要gcc7环境,故将其降级

  • 安装gcc7

    1
    $ sudo apt install gcc-7 g++-7
    
  • 进行版本切换(改变优先级)

    1
    2
    $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
    $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 50
    
  • 查看优先级

    1
    $ sudo update-alternatives --config gcc
    
  • 查看当前版本

    1
    $ gcc -v
    

GPG error: The following signatures couldn’t be verified because the public key is not available.

  • sudo apt update 出现该问题

  • 解决方法:

    1
    2
    $ sudo gpg --keyserver keyserver.ubuntu.com --recv <your public key>					#plic key 根据错误提示写
    $ sudo gpg --export --armor <your public key> | sudo apt-key add -