因为brew install ranger安装出来的ranger是基于python2的,nvim中无法使用rnvimr插件。所以需要使用pip3安装一下ranger.
在centos7 中使用linuxbrew安装的python3不自带pip3,我本想使用pip3安装ranger,发现安装不了。因为环境变量中的pip3还是centos7中使用yum安装的低版本pip3。这时环境变量就比较混乱。
- python3是brew安装的新版本python3.9
- pip3是yum安装python3.6自带的
解决思路: python3使用brew安装的最新版本的(3.9),pip3使用python3.9自行安装。这样就不会混乱了。
安装pip3包管理工具如果没有 python3,则先安装:
brew install python3
安装完成, 可以继续安装 pip3 包管理工具:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
增加环境变量
export PATH=/home/linuxbrew/.linuxbrew/Cellar/python@3.9/3.9.4/bin:$PATH
自己安装的python路径一定要写在前面,这样可以优先级高于yum安装出来的python。 检查一下版本:
python3 -V
pip3 -V
安装ranger
pip3 install ranger-fm -i https://mirrors.aliyun.com/pypi/simple/
pip3 install pynvim -i https://mirrors.aliyun.com/pypi/simple/
执行结果如下:
pip3 install ranger-fm -i https://mirrors.aliyun.com/pypi/simple/
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting ranger-fm
Using cached https://mirrors.aliyun.com/pypi/packages/7e/19/a7d9bb8646f87df5a3126fc385e45c04e55639c0576d31351083cb02f248/ranger-fm-1.9.3.tar.gz (226 kB)
Building wheels for collected packages: ranger-fm
Building wheel for ranger-fm (setup.py) ... done
Created wheel for ranger-fm: filename=ranger_fm-1.9.3-py3-none-any.whl size=316802 sha256=0812a4e77e4190e4ec3af0bb120f1dcda5f115ddbb35abcb51c9b3b159936e88
Stored in directory: /home/vncuser/.cache/pip/wheels/5a/51/f9/0edef471916449511cf46c37941d4b91dba2ee99ab9fe30d83
Successfully built ranger-fm
Installing collected packages: ranger-fm
Successfully installed ranger-fm-1.9.3
可以愉快的使用rnvimr了
https://www.jianshu.com/p/fd9a3aead175