24 Mar

“spyder error: ‘import sitecustomize’ failed; use -v for traceback

#this article was transferred from my Blogger.

win8 spyder

the programm is totally correct, and it did give a correct out put

but after the out put there is an error message reads:”spyder error: ‘import sitecustomize’ failed; use -v for traceback”

solve:#8 NathanH…@gmail.com

I decided to set an environment variable in Windows 7 to see if it would fix the problem.  I made a variable named SPYDER_ENCODING and set it to UTF-8.  I no longer get the error.  Is there some problem that spyder has with windows 7's default encoding?  Does anybody have any ideas?

from: https://code.google.com/p/spyderlib/issues/detail?id=771
24 Mar

py2exe的一些问题。

几个月前编译完全正常的一个py文件昨天重新编译就出了一连串问题。分别解决如下。
1、首先是RuntimeError: maximum recursion depth exceeded导致编译中断。在STO提问得到解决:在setup文件开头添上:
import sys
sys.setrecursionlimit(5000)
即可。

2.虽然编译出了exe,但是得到的exe运行时报告缺少“_validation”。解决办法是在setup文件中将validation手动include进去,像这样:
# mysetup.py
import sys
sys.setrecursionlimit(50000)
from distutils.core import setup
import py2exe
options = {
“py2exe”: {“compressed”:1,
“optimize”:2,
“includes”:[“scipy.sparse.csgraph._validation”,”scipy.special._ufuncs_cxx”,”sympy.printing.gtk”],
“bundle_files”:1}
};
setup(
windows = [“nlk.py”],
options = options,
)
其中的scipy.sparse.csgraph._validation”,”scipy.special._ufuncs_cxx”,”sympy.printing.gtk都是根据后来的报错逐个添加进去的。期间还安装了gtk这个包。至于这是个啥?不知道。

3.最后一个问题是如下报错:
OMP: Warning #178: Function GetModuleHandleEx failed
OMP: System error #126: The specified module could not be found.
STO上一个相关问题给出的建议是去sourceforge重新安装numpy1.8.1。试了但无效。后来发现将setup文件中的bundle_files值改为3就正常。但是这样得到的exe就不是单一文件了,有点不爽。而且体积奇大,6k的脚本编译出来一个近200M的文件夹。

总之呢,这个可执行文件算是有了。优化的事以后再说吧。(:3っ)∋