ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with rifle, a file launcher that is good at automatically finding out which program to use for what file type.
https://github.com/ranger/ranger

image.png

一般安装 ranger 是通过包管理器安装的,例如 apt 包管理器可以通过如下的命令安装 :

sudo apt install ranger

但有些时候没有 sudo 权限,或者因为 python2 python3 之间的 python 问题导致的 ranger 无法正确启动。

这时候我们可以通过 pip 安装。

但是通过下面的命令是行不通的 ❌

pip install ranger

下面的命令才是正确的✅

pip install ranger-fm

这里就不得吐槽一下 pypi 的包名称和导包的时候不一致的问题了

想要了解更多知识点,看这个吧Linux 下 pip 多版本管理


─➤  ranger
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/bin/ranger", line 36, in <module>
    import ranger  # NOQA pylint: disable=import-self,wrong-import-position
ModuleNotFoundError: No module named 'ranger'
╰─➤  pip uninstall ranger-fm
Found existing installation: ranger-fm 1.9.3
Uninstalling ranger-fm-1.9.3:
  Would remove:
    /Library/Frameworks/Python.framework/Versions/3.9/bin/ranger
    /Library/Frameworks/Python.framework/Versions/3.9/bin/rifle
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/*
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger_fm-1.9.3-py3.9.egg-info
    /Library/Frameworks/Python.framework/Versions/3.9/share/applications/ranger.desktop
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/CHANGELOG.md
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/HACKING.md
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/README.md
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/colorschemes.md
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/config/colorschemes/default.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/config/colorschemes/jungle.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/config/colorschemes/snow.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/config/commands.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/config/rc.conf
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/config/rifle.conf
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/config/scope.sh
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/README
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/fish_automatic_cd.fish
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_avfs.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_chmod_keybindings.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_fasd_add.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_file_filter.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_hello_world.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_ipc.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_linemode.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_new_macro.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_new_sorting_method.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_pmount.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/plugin_pmount_dynamic.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/rc_emacs.conf
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/rifle_different_file_opener.conf
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/rifle_sxiv.sh
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/shell_automatic_cd.sh
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/shell_subshell_notice.sh
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/examples/vim_file_chooser.vim
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/tools/convert_papermode_to_metadata.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/tools/performance_test.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/tools/print_colors.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/doc/ranger/tools/print_keys.py
    /Library/Frameworks/Python.framework/Versions/3.9/share/man/man1/ranger.1
    /Library/Frameworks/Python.framework/Versions/3.9/share/man/man1/rifle.1
  Would not remove (might be manually added):
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/release.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/Collections/RangeBucketMap.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/Collections/RangeMap.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/Collections/RangeSet.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/Collections/__init__.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/Range/Cut.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/Range/Range.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/Range/__init__.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/src/__init__.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/__init__.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Collections/CollectionsTestSuite.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Collections/RangeBucketMapTest.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Collections/RangeMapTest.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Collections/RangeSetTest.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Collections/__init__.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Range/CutTest.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Range/RangeTest.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Range/RangeTestSuite.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/Range/__init__.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/__init__.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/test/src/mainTestSuite.py
    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ranger/version.py
Proceed (Y/n)? n
In [4]: import sys

In [5]: sys.path
Out[5]:
['/Library/Frameworks/Python.framework/Versions/3.9/bin',
 '/Library/Frameworks/Python.framework/Versions/3.9/lib/python39.zip',
 '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9',
 '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload',
 '',
 '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages',
 '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/IPython/extensions',
 '/Users/bot/.ipython']

universe_king
3.4k 声望678 粉丝