,安装步骤很简单,直接运行:sudo apt-get install zsh
sudo apt-get install zsh
然后切换当前 shell 至 zsh 就成功了:
chsh -s /bin/zsh
更新后会输出一个:
# Updated process:[oh-my-zsh] Would you like to update? [Y/n] Y
Updating Oh My Zsh ...
remote: Enumerating objects: 154, done.
remote: Counting objects: 100% (154/154), done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 116 (delta 69), reused 84 (delta 38), pack-reused 0
Receiving objects: 100% (116/116), 27.17 KiB | 11.00 KiB/s, done.
Resolving deltas: 100% (69/69), completed with 24 local objects.
From https://github.com/ohmyzsh/ohmyzsh
* branch master -> FETCH_HEAD
93c837f..c549387 master -> origin/master
README.md | 61 +++---
lib/functions.zsh | 4 +-
lib/termsupport.zsh | 12 +-
plugins/aws/aws.plugin.zsh | 1 -
plugins/bgnotify/bgnotify.plugin.zsh | 2 +-
plugins/brew/README.md | 7 +-
plugins/brew/brew.plugin.zsh | 1 +
plugins/bundler/README.md | 79 +++++---
plugins/bundler/bundler.plugin.zsh | 116 ++++++-----
plugins/compleat/compleat.plugin.zsh | 7 +-
plugins/composer/composer.plugin.zsh | 2 +
plugins/drush/drush.plugin.zsh | 2 -
plugins/git/git.plugin.zsh | 14 +-
plugins/ipfs/LICENSE | 22 ++
plugins/ipfs/README.md | 17 ++
plugins/ipfs/_ipfs | 717 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
plugins/laravel5/laravel5.plugin.zsh | 19 +-
plugins/minikube/minikube.plugin.zsh | 10 +-
plugins/pip/pip.plugin.zsh | 6 +-
plugins/stack/stack.plugin.zsh | 1 -
plugins/sublime-merge/README.md | 17 ++
plugins/sublime-merge/sublime-merge.plugin.zsh | 55 +++++
plugins/terraform/README.md | 3 +-
plugins/terraform/terraform.plugin.zsh | 2 +
plugins/wp-cli/wp-cli.plugin.zsh | 1 -
themes/agnoster.zsh-theme | 2 +-
themes/avit.zsh-theme | 4 +-
27 files changed, 1017 insertions(+), 167 deletions(-)
create mode 100644 plugins/ipfs/LICENSE
create mode 100644 plugins/ipfs/README.md
create mode 100644 plugins/ipfs/_ipfs
create mode 100644 plugins/sublime-merge/README.md
create mode 100644 plugins/sublime-merge/sublime-merge.plugin.zsh
First, rewinding head to replay your work on top of it...
Fast-forwarded master to c549387745205d7fa8e91c1e6dcdae6901d9dd1d.
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/
Hooray! Oh My Zsh has been updated and/or is at the current version.
To keep up on the latest news and updates, follow us on Twitter: https://twitter.com/ohmyzsh
Want to get involved in the community? Join our Discord: https://discord.gg/ohmyzsh
Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh
打开文件 .zshrc
,更改 ZSH_THEME=
至 ZSH_THEME="agnoster"
,打开的方法如下(用 Nano 编辑):
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
nano ~/.zshrc
实际上,此时 reboot
后看到的是奇怪的样式,需要调整字体才能让它正常起来,进入官网下载相应的字体,直接双击安装后,在 WSL 命令行窗口直接 右键->属性->字体
并更改字体的样式即可。
发现竟然有编译错误!!具体错误为:/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/sophus/so2.cpp: In constructor ‘Sophus::SO2::SO2()’:
/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment
32 | unit_complex_.real() = 1.;
| ^~
/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment
33 | unit_complex_.imag() = 0.;
| ^~
make[2]: *** [CMakeFiles/Sophus.dir/build.make:66: CMakeFiles/Sophus.dir/sophus/so2.cpp.o] Error 1
make[2]: Leaving directory '/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/build'
make[1]: *** [CMakeFiles/Makefile2:91: CMakeFiles/Sophus.dir/all] Error 2
make[1]: Leaving directory '/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/build'
make: *** [Makefile:144: all] Error 2
/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/sophus/so2.cpp: In constructor ‘Sophus::SO2::SO2()’:
/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment
32 | unit_complex_.real() = 1.;
| ^~
/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment
33 | unit_complex_.imag() = 0.;
| ^~
make[2]: *** [CMakeFiles/Sophus.dir/build.make:66: CMakeFiles/Sophus.dir/sophus/so2.cpp.o] Error 1
make[2]: Leaving directory '/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/build'
make[1]: *** [CMakeFiles/Makefile2:91: CMakeFiles/Sophus.dir/all] Error 2
make[1]: Leaving directory '/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/build'
make: *** [Makefile:144: all] Error 2
于是去寻找路径下名为 so2.cpp
的源文件,找到如下代码:
SO2::SO2()
{
unit_complex_.real() = 1.;
unit_complex_.imag() = 0.;
}
显然这种赋值方式是 XXX 的,应该用实参的形式赋值,也就是说,改成下面的形式:
SO2::SO2()
{
//unit_complex_.real() = 1.;
//unit_complex_.imag() = 0.;
unit_complex_.real(1.);
unit_complex_.imag(0.);
}
然后重新编译一下,就通过了:
/usr/bin/cmake -E cmake_progress_start /mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/sophus/build/CMakeFiles 0
接着的使用中会遇到的麻烦事是找不到 Sophus
库,需要把 CMakeLists.txt
里面写上你安装的 Sophus
库的头文件路径以及共享库的路径:
# Use the set(·) command to input the directories of Sophus
set(Sophus_INCLUDE_DIRS "/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/Sophus/sophus")
set(Sophus_LIBS "/mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/Sophus/build/libSophus.so")
find_package(Sophus REQUIRED)
include_directories(
${Sophus_INCLUDE_DIRS}
)
target_link_libraries(useSophus ${Sophus_LIBRARIES})
咳咳,上面是非模板 Sophus
的安装和使用,,下面才是模板库的,命令行如下(记得不要回滚):
git clone https://github.com/strasdat/Sophus.git
cd /mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/SophusTemplate
mkdir build
cd build
cmake ..
make
sudo make install
并没有任何编译错误,这样一下子安装下来就是只有头文件的 Sophus
,就像 eigen3
一样的,它和非模板库的区别在于,这个里面的类型定义都是基于模板的,也就是说,有更强的泛化性能。
安装 Ceres、g2o、检测是否成功
同前,首先应当安装依赖:
sudo apt-get install qt5-qmake qt5-default libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod3
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev
然后进入编译:
git clone https://github.com/RainerKuemmerle/g2o.git
sudo apt-get install libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev-qt5
sudo su
cd g2o
mkdir build
cd build
cmake ../
make -j8
sudo make install
遇到了编译错误:
/usr/lib/qt5/bin/uic: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
make[2]: *** [g2o/apps/g2o_viewer/CMakeFiles/viewer_library.dir/build.make:62: g2o/apps/g2o_viewer/ui_base_main_window.h] Error 127
make[1]: *** [CMakeFiles/Makefile2:1580: g2o/apps/g2o_viewer/CMakeFiles/viewer_library.dir/all] Error 2
查了一下,这个错误名为 error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
,还好还好,有个解决思路帮助我成功解决了这个问题,似乎为 WSL 特有的,运行如下语句后再进行编译就可以了:
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
开了7个线程,花了得有接近 3~4 min 叭才弄完,但是完了就好完了就好,最后别忘了 sudo make install
一下。
用 g2o_viewer
run 一下 sphere.g2o
来证明一下已经下载完成:
./g2o/bin/g2o_viewer /mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/3rdparty/ch10/sphere.g2o
一个需要注意的点是,最好别在别的位置编译 g2o
库,可能会报错告诉你路径里有中文。
安装 OpenCV4.4、检测是否成功
详细安装步骤以及检测见我的 OpenCV4.4.0 Installation & Examination 教程。
Cmake、g++
在 WSL 中使用 g++ 打印虚表的操作如下,会自动写到一个文件里:
g++ -fdump-class-hierarchy XXX.cpp
使用 g++ 导出继承结构的指令如下:
g++ -fdump-class-hierarchy -c XXX.cpp
Cmake 的简单用法
构建 CMakeList.txt 如下,注意一定要把保存的编码格式改成 UTF8
:
# The lowest version required
cmake_minimum_required( VERSION 2.8 )
# Project name
project( HelloSLAM )
# The executable file addition
add_executable( helloSLAM helloSLAM.cpp )
在终端输入:
# Path to slambook/ch2
cd /mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/Demolist/slamdemo/slambook/ch2
# CMake, the current path
cmake .
make
# Run the executable file
./helloSLAM
可以通过新建并切换到 build
文件夹,并对于上一个文件夹进行编译,就可以将 cmake 编译时产生的文件生成在 build
里面,这样有利于源代码的发布:
mkdir build
cd build
cmake ..
make
注意每次编译时都记得把以前的 Makefile 删除。
Python 的简单用例
学会用命令行调用 Python
标准库的 doctest
,从而生成代码的分析文件,首先自然是切换到相应的路径:
cd /mnt/c/Users/a1020/Desktop/Reinforcement_ELyou/#Pythonic/Fluent-Python/01-data-model
运行下面的指令,调用 doctest
,可以获得一个名为 frenchdeck.doctest
的文件:
python3 -m doctest frenchdeck.py
文件内容为代码的分析:
>>> from frenchdeck import FrenchDeck, Card
>>> beer_card = Card('7', 'diamonds')
>>> beer_card
Card(rank='7', suit='diamonds')
>>> deck = FrenchDeck()
>>> len(deck)
52
>>> deck[:3]
[Card(rank='2', suit='spades'), Card(rank='3', suit='spades'), Card(rank='4', suit='spades')]
>>> deck[12::13]
[Card(rank='A', suit='spades'), Card(rank='A', suit='diamonds'), Card(rank='A', suit='clubs'), Card(rank='A', suit='hearts')]
>>> Card('Q', 'hearts') in deck
True
>>> Card('Z', 'clubs') in deck
False
>>> for card in deck: # doctest: +ELLIPSIS
... print(card)
Card(rank='2', suit='spades')
Card(rank='3', suit='spades')
Card(rank='4', suit='spades')
...
>>> for card in reversed(deck): # doctest: +ELLIPSIS
... print(card)
Card(rank='A', suit='hearts')
Card(rank='K', suit='hearts')
Card(rank='Q', suit='hearts')
...
>>> for n, card in enumerate(deck, 1): # doctest: +ELLIPSIS
... print(n, card)
1 Card(rank='2', suit='spades')
2 Card(rank='3', suit='spades')
3 Card(rank='4', suit='spades')
...
>>> suit_values = dict(spades=3, hearts=2, diamonds=1, clubs=0)
>>> def spades_high(card):
... rank_value = FrenchDeck.ranks.index(card.rank)
... return rank_value * len(suit_values) + suit_values[card.suit]
Rank test:
>>> spades_high(Card('2', 'clubs'))
0
>>> spades_high(Card('A', 'spades'))
51
>>> for card in sorted(deck, key=spades_high): # doctest: +ELLIPSIS
... print(card)
Card(rank='2', suit='clubs')
Card(rank='2', suit='diamonds')
Card(rank='2', suit='hearts')
...
Card(rank='A', suit='diamonds')
Card(rank='A', suit='hearts')
Card(rank='A', suit='spades')