Nautilus 和 Nemo 对 python 文件使用两个不同的图标:
但我希望他们显示所有 python 文件的 python 图标。
mimetype为两个文件提供相同的结果:
$ mimetype *.py
buy_test.py: text/x-python
candlestick_test.py: text/x-python
Run Code Online (Sandbox Code Playgroud)
file -i给出不同的输出:
$ file -i buy_test.py
buy_test.py: text/x-python; charset=us-ascii
$ file -i candlestick_test.py
candlestick_test.py: text/x-objective-c; charset=us-ascii
Run Code Online (Sandbox Code Playgroud)
Candlestick_test.py的输出是错误的,但此文件显示为 python 图标。不知道为什么。
这里有人遇到了同样的问题: Ubuntu 文件管理器没有显示正确的图标
但是他得到的答案对我不起作用:
$ grep -r 'text/x-python' /usr/share/thumbnailers
Run Code Online (Sandbox Code Playgroud)
没有输出。
我认为这些python文件之间的主要区别是shebang:
$ head -n2 buy_test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
$ head -n2 candlestick_test.py
# -*- coding: utf-8 -*-
"""
Run Code Online (Sandbox Code Playgroud)
当我使用这个shebang(python 2)时......
#!/usr/bin/env python
Run Code Online (Sandbox Code Playgroud)
...还有一个python图标。
Nautilus 和 …