突然之间,很多 python 程序都出现了相同的错误

2014-11-28 22:19:08 +08:00
 abccba
Gentoo Linux环境,今天突然发现很多python程序都不能用了:例如pip/equery/markdown2,还有其它众多python程序

重现问题:
在终端里直接输入pip或者equery或者markdown2,不用任何参数,就能看到相同的错误输出。

不知道是哪里出了问题。。。

执行`equery`时的错误输出如下:(执行pip/markdown2时结果一样,除了/usr/bin/xxx那几句)

Usage: /usr/bin/equery [-l <lexer> | -g] [-F <filter>[:<options>]] [-f <formatter>]
[-O <options>] [-P <option=value>] [-o <outfile>] [<infile>]

/usr/bin/equery -S <style> -f <formatter> [-a <arg>] [-O <options>] [-P <option=value>]
/usr/bin/equery -L [<which> ...]
/usr/bin/equery -N <filename>
/usr/bin/equery -H <type> <name>
/usr/bin/equery -h | -V

Highlight the input file and write the result to <outfile>.

If no input file is given, use stdin, if -o is not given, use stdout.

<lexer> is a lexer name (query all lexer names with -L). If -l is not
given, the lexer is guessed from the extension of the input file name
(this obviously doesn't work if the input is stdin). If -g is passed,
attempt to guess the lexer from the file contents, or pass through as
plain text if this fails (this can work for stdin).

Likewise, <formatter> is a formatter name, and will be guessed from
the extension of the output file name. If no output file is given,
the terminal formatter will be used by default.

With the -O option, you can give the lexer and formatter a comma-
separated list of options, e.g. ``-O bg=light,python=cool``.

The -P option adds lexer and formatter options like the -O option, but
you can only give one option per -P. That way, the option value may
contain commas and equals signs, which it can't with -O, e.g.
``-P "heading=Pygments, the Python highlighter".

With the -F option, you can add filters to the token stream, you can
give options in the same way as for -O after a colon (note: there must
not be spaces around the colon).

The -O, -P and -F options can be given multiple times.

With the -S option, print out style definitions for style <style>
for formatter <formatter>. The argument given by -a is formatter
dependent.

The -L option lists lexers, formatters, styles or filters -- set
`which` to the thing you want to list (e.g. "styles"), or omit it to
list everything.

The -N option guesses and prints out a lexer name based solely on
the given filename. It does not take input or highlight anything.
If no specific lexer can be determined "text" is returned.

The -H option prints detailed help for the object <name> of type <type>,
where <type> is one of "lexer", "formatter" or "filter".

The -h option prints this help.
The -V option prints the package version.
4418 次点击
所在节点    Python
26 条回复
skydiver
2014-11-29 00:41:45 +08:00
@abccba 灌是台湾说法吧。。重灌狂人。。
abccba
2014-11-29 08:05:53 +08:00
顶起,看看有木有大牛能帮着解决下。谢谢。
loading
2014-11-29 09:45:24 +08:00
欢迎来 archlinux
2owe
2014-11-29 16:43:37 +08:00
推测 Pygments版本过高,可以的话执行pip freeze|grep Pygments 看看是否高于1.6

如果是这样,应该卸载Pygments,重新安装1.6版本的 Pygments。

一点点建议:1. Linux python 开发环境 应与系统默认 python 环境区分开 2. 使用pythonenv 管理自己的开发环境 3.系统环境包除非你知道自己在做什么否则别动它,自己的环境多备份以便深度折腾。 :)
abccba
2014-12-01 07:33:54 +08:00
@2owe
谢谢,已经搞定了:是pip和Gentoo的包管理器冲突导致的奇怪错误。emerge -v1 python-exec就好。

再次谢谢您的建议!
Owenjia
2014-12-19 13:28:19 +08:00
我也遇到了类似的问题,但 pip 可以用,emerge 不能用了~~~

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/150079

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX