Wednesday, June 12, 2019

vim 总结



toturial: https://vimhelp.org/





vim - A modal editor based on the classic ‘vi’ editor by Bill Joy.


Vim quick reference


Changing modes


Enter command mode: :


Enter typing mode: i (insert at cursor), a (append after cursor), A (append at end of line)


Exit command or typing mode: ESC


Moving (you must not be in command or typing mode)


By line or column: use the arrow keys or h (left), j (down), k (up), l (right)


Go to beginning/end of line: 0 or $


Go to beginning/end of file: 1G or G


Go to particular line: type the linenumber and press G


Prev/next word: gE or W


Beginning/end of word: e or b


Search: /search term or regex


Opening, saving and closing files


Open a file: :e filename or path


Save and exit: :x


Save without exiting: :w


Exit without saving: :q!


Getting help


In-editor help: :help





The less command allows you to use these key-commands to move around the file
x

Monday, June 10, 2019

如何半自动安装python package

全自动: pip install xxx
半自动:一些python package 有setup.py xx install . 可以follow 这些instruction
如果没有write access 到site-package 这种系统路径,需要把package 安装到自己设定的路径下面去,具体参考网页https://docs.python.org/2.7/install/index.html#alternate-installation
举例来说,
python setup.py install --home=/home/ec2-user/workspaces/hoverboard-workspaces/lib

此时,需要把当前目录装在PYTHONPATH里面去,

vim ~/.bashrc
PYTHONPATH=~/one/location:$PYTHONPATH
PYTHONPATH=~/second/location:$PYTHONPATH
export PYTHONPATH
source ~/.bashrc
如果有其他依赖的话,还需要安装其他依赖package.





如果在断网的情况下pip install package, 为了避免平台问题(比如amazon hoverboard),需要先把package 所有依赖的源代码下载下来,然后再安装。具体见:
https://www.cnblogs.com/jay54520/p/8330994.html
https://www.jianshu.com/p/f8a3f3a07aff
https://blog.csdn.net/pierre_/article/details/54234151
http://imshuai.com/python-pip-install-package-offline-tensorflow/


如果感觉没有问题,比如wheel 文件适合当前平台的话,可以download 对应的whl文件,然后通过
pip install --user -v --no-index "${WHEELS_LOC}certifi-2018.11.29-py2.py3-none-any.whl"
进行安装