emacs里运行python程序错误

Vim、Emacs配置和使用
回复
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

emacs里运行python程序错误

#1

帖子 drongh » 2012-02-12 0:57

我在emacs里运行python,错误,请看:
pychecker --stdlib newfile.py

/bin/bash: pychecker: command not found

compilation exited abnormaly with code 127 at Sun Feb


这个怎么解决,是不是pychecker没有安装,或怎么安装。谢谢。
头像
cuihao
帖子: 4793
注册时间: 2008-07-24 11:33
来自: 郑州
联系:

Re: emacs里运行python程序错误

#2

帖子 cuihao » 2012-02-12 8:14

代码: 全选

sudo apt-get install pychecker
自己试一下就好啦。
求人不如求它仨: 天蓝的Wiki 屎黄的Wiki 绿
Site: CUIHAO.TK    Twitter: @cuihaoleo
Machine: Athlon64 X2 5200+ / 2x2GB DDR2-800 / GeForce GTS 450
AD: ~まだ見ぬ誰かの笑顔のために~
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: emacs里运行python程序错误

#3

帖子 drongh » 2012-02-12 11:55

谢谢。搞好了。
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: emacs里运行python程序错误

#4

帖子 drongh » 2012-02-12 12:27

-*- mode: compilation; default-directory: "/home/drongh/" -*-
Compilation started at Sun Feb 12 12:25:15

pychecker --stdlib newfile.py
Processing module newfile (newfile.py)...
Caught exception importing module newfile:
File "/usr/lib/pymodules/python2.7/pychecker/pcmodules.py", line 540, in setupMainCode()
module = imp.load_module(self.moduleName, handle, filename, smt)
IndentationError: unexpected indent (newfile.py, line 1)

Warnings...

newfile:1: NOT PROCESSED UNABLE TO IMPORT

Compilation exited abnormally with code 1 at Sun Feb 12 12:25:16



上面的编译错误怎么弄,我就写了一句啊。请看下面。
print "hello, world"
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: emacs里运行python程序错误

#5

帖子 drongh » 2012-02-12 16:38

解决了上面的问题,又出来新的问题,在调试状态无法调出shell。
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: emacs里运行python程序错误

#6

帖子 drongh » 2012-02-12 16:53

[img]file:///home/drongh/Pictures/Screenshot%20at%202012-02-12%2016:51:37.png[/img]


在下面的buffer里,我没法输入字符,大家帮我看看。
kardinal
帖子: 750
注册时间: 2006-03-19 11:39

Re: emacs里运行python程序错误

#7

帖子 kardinal » 2012-02-12 17:19

drongh 写了: IndentationError: unexpected indent (newfile.py, line 1)
python 只是生个好皮囊罢了
如果学习编程或者日常管理的话,学学 ruby 好 了
关键是 ruby 有本好书,matz 参与写的那本书就很不错
python 就没有同样犀利的教程……
也许对于 python 的设计,想清晰的描述也不太可能
kardinal
帖子: 750
注册时间: 2006-03-19 11:39

Re: emacs里运行python程序错误

#8

帖子 kardinal » 2012-02-12 18:08

其实 lisp 也挺不错的
把 lisp 的 loop 包装了一下,貌似 python 的列表解析……功能要强大一点
https://github.com/ran9er/init.emacs/bl ... %2Bloop.el
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: emacs里运行python程序错误

#9

帖子 drongh » 2012-02-13 22:23

python语法简单啊。
kardinal
帖子: 750
注册时间: 2006-03-19 11:39

Re: emacs里运行python程序错误

#10

帖子 kardinal » 2012-02-13 23:44

看似简单而已
其实还是挺严格的,最明显的就是缩进
还有像有些语句行尾冒号的使用,对于单行代码的限制,lambda 表达式的限制,类变量的 self 前缀……诸如此类,不一而足
尤其是2-3版本的动荡把这趟水搅得更浑
总体来说,是一种挺死板的语言……十分滑稽的是,死板的同时一致性却不怎么好(像对于闭包的处理,列表解析的语法)……要了亲命咧

个人感觉,要论简单,应该数 ruby,它很柔顺,不会硌得你浑身难受,你开始实际的编写代码时,它不会总让你意外和摸不着头脑,而且里面有很多有趣的东西。
像两碗米饭,一碗里面掺点鸡蛋火腿,另一碗就厉害了……里面掺点沙
回复