2016年8月30日 星期二

【Ubuntu】安裝cx_Freeze會出現 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1.

因為要把寫好的Python的程式碼打包,需要安裝cx_Freeze,按照官網的安裝方式:
    pip install cx_Freeze

會出現錯誤訊息:
    adding base module named StringIO
    adding base module named StringIO
    adding base module named UserDict
    adding base module named _abcoll
    adding base module named _weakrefset
    adding base module named abc
    adding base module named base64
    adding base module named codecs
    adding base module named copy
    adding base module named copy_reg
    adding base module named encodings
    adding base module named encodings.aliases
    adding base module named encodings.ascii
    adding base module named encodings.base64_codec
    adding base module named encodings.big5
    adding base module named encodings.big5hkscs
    adding base module named encodings.bz2_codec
    adding base module named encodings.charmap
    adding base module named encodings.cp037
    adding base module named encodings.cp1006
    adding base module named encodings.cp1026
    adding base module named encodings.cp1140
    adding base module named encodings.cp1250
    adding base module named encodings.cp1251
    adding base module named encodings.cp1252
    adding base module named encodings.cp1253
    adding base module named encodings.cp1254
    adding base module named encodings.cp1255
    adding base module named encodings.cp1256
    adding base module named encodings.cp1257
    adding base module named encodings.cp1258
    adding base module named encodings.cp424
    adding base module named encodings.cp437
    adding base module named encodings.cp500
    adding base module named encodings.cp720
    adding base module named encodings.cp737
    adding base module named encodings.cp775
    adding base module named encodings.cp850
    adding base module named encodings.cp852
    adding base module named encodings.cp855
    adding base module named encodings.cp856
    adding base module named encodings.cp857
    adding base module named encodings.cp858
    adding base module named encodings.cp860
    adding base module named encodings.cp861
    adding base module named encodings.cp862
    adding base module named encodings.cp863
    adding base module named encodings.cp864
    adding base module named encodings.cp865
    adding base module named encodings.cp866
    adding base module named encodings.cp869
    adding base module named encodings.cp874
    adding base module named encodings.cp875
    adding base module named encodings.cp932
    adding base module named encodings.cp949
    adding base module named encodings.cp950
    adding base module named encodings.euc_jis_2004
    adding base module named encodings.euc_jisx0213
    adding base module named encodings.euc_jp
    adding base module named encodings.euc_kr
    adding base module named encodings.gb18030
    adding base module named encodings.gb2312
    adding base module named encodings.gbk
    adding base module named encodings.hex_codec
    adding base module named encodings.hp_roman8
    adding base module named encodings.hz
    adding base module named encodings.idna
    adding base module named encodings.iso2022_jp
    adding base module named encodings.iso2022_jp_1
    adding base module named encodings.iso2022_jp_2
    adding base module named encodings.iso2022_jp_2004
    adding base module named encodings.iso2022_jp_3
    adding base module named encodings.iso2022_jp_ext
    adding base module named encodings.iso2022_kr
    adding base module named encodings.iso8859_1
    adding base module named encodings.iso8859_10
    adding base module named encodings.iso8859_11
    adding base module named encodings.iso8859_13
    adding base module named encodings.iso8859_14
    adding base module named encodings.iso8859_15
    adding base module named encodings.iso8859_16
    adding base module named encodings.iso8859_2
    adding base module named encodings.iso8859_3
    adding base module named encodings.iso8859_4
    adding base module named encodings.iso8859_5
    adding base module named encodings.iso8859_6
    adding base module named encodings.iso8859_7
    adding base module named encodings.iso8859_8
    adding base module named encodings.iso8859_9
    adding base module named encodings.johab
    adding base module named encodings.koi8_r
    adding base module named encodings.koi8_u
    adding base module named encodings.latin_1
    adding base module named encodings.mac_arabic
    adding base module named encodings.mac_centeuro
    adding base module named encodings.mac_croatian
    adding base module named encodings.mac_cyrillic
    adding base module named encodings.mac_farsi
    adding base module named encodings.mac_greek
    adding base module named encodings.mac_iceland
    adding base module named encodings.mac_latin2
    adding base module named encodings.mac_roman
    adding base module named encodings.mac_romanian
    adding base module named encodings.mac_turkish
    adding base module named encodings.mbcs
    adding base module named encodings.palmos
    adding base module named encodings.ptcp154
    adding base module named encodings.punycode
    adding base module named encodings.quopri_codec
    adding base module named encodings.raw_unicode_escape
    adding base module named encodings.rot_13
    adding base module named encodings.shift_jis
    adding base module named encodings.shift_jis_2004
    adding base module named encodings.shift_jisx0213
    adding base module named encodings.string_escape
    adding base module named encodings.tis_620
    adding base module named encodings.undefined
    adding base module named encodings.unicode_escape
    adding base module named encodings.unicode_internal
    adding base module named encodings.utf_16
    adding base module named encodings.utf_16_be
    adding base module named encodings.utf_16_le
    adding base module named encodings.utf_32
    adding base module named encodings.utf_32_be
    adding base module named encodings.utf_32_le
    adding base module named encodings.utf_7
    adding base module named encodings.utf_8
    adding base module named encodings.utf_8_sig
    adding base module named encodings.uu_codec
    adding base module named encodings.zlib_codec
    adding base module named genericpath
    adding base module named linecache
    adding base module named ntpath
    adding base module named os
    adding base module named posixpath
    adding base module named quopri
    adding base module named repr
    adding base module named stat
    adding base module named string
    adding base module named stringprep
    adding base module named struct
    adding base module named traceback
    adding base module named types
    adding base module named warnings
    adding base module named weakref
    running install
    running build
    running build_py
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/windist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/dist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/freezer.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/__init__.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/setupwriter.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/common.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/finder.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/hooks.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/main.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    copying cx_Freeze/macdist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
    creating build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
    copying cx_Freeze/initscripts/SharedLib.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
    copying cx_Freeze/initscripts/Console.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
    copying cx_Freeze/initscripts/ConsoleSetLibPath.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
    copying cx_Freeze/initscripts/SharedLibSource.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
    copying cx_Freeze/initscripts/ConsoleKeepPath.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
    copying cx_Freeze/samples/advanced/advanced_1.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
    copying cx_Freeze/samples/advanced/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
    copying cx_Freeze/samples/advanced/advanced_2.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
    copying cx_Freeze/samples/zope/qotd.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
    copying cx_Freeze/samples/zope/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
    copying cx_Freeze/samples/wx/wxapp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
    copying cx_Freeze/samples/wx/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
    copying cx_Freeze/samples/Tkinter/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
    copying cx_Freeze/samples/Tkinter/SimpleTkApp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
    copying cx_Freeze/samples/relimport/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
    copying cx_Freeze/samples/relimport/relimport.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
    copying cx_Freeze/samples/simple/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
    copying cx_Freeze/samples/simple/hello.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
    copying cx_Freeze/samples/PyQt4/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
    copying cx_Freeze/samples/PyQt4/PyQt4app.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
    copying cx_Freeze/samples/matplotlib/matplotlib_eg.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
    copying cx_Freeze/samples/matplotlib/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
    creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
    copying cx_Freeze/samples/service/ServiceHandler.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
    copying cx_Freeze/samples/service/Config.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
    copying cx_Freeze/samples/service/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
    running build_ext
    building 'cx_Freeze.util' extension
    creating build/temp.linux-x86_64-2.7/source
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/util.c -o build/temp.linux-x86_64-2.7/source/util.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/source/util.o -o build/lib.linux-x86_64-2.7/cx_Freeze/util.so
    creating build/temp.linux-x86_64-2.7/source/bases
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Ibuild/temp.linux-x86_64-2.7 -I/usr/include/python2.7 -c source/bases/Console.c -o build/temp.linux-x86_64-2.7/source/bases/Console.o
    creating build/lib.linux-x86_64-2.7/cx_Freeze/bases
    x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64-2.7/source/bases/Console.o -o build/lib.linux-x86_64-2.7/cx_Freeze/bases/Console -s
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 GetImporterHelper:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:221: 未定義參考到「PyObject_CallMethod」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:225: 未定義參考到「PyErr_Clear」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 GetDirName:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:76: 未定義參考到「PyString_FromStringAndSize」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 FatalError:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 SetExecutableName:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:103: 未定義參考到「PyString_FromString」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:125: 未定義參考到「PyString_FromStringAndSize」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:146: 未定義參考到「PyString_FromString」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 FatalError:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 SetExecutableName:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:165: 未定義參考到「PyString_FromString」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:177: 未定義參考到「PyString_FromString」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 FatalError:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 SetExecutableName:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:112: 未定義參考到「PyExc_OSError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:112: 未定義參考到「PyErr_SetFromErrnoWithFilename」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 FatalError:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 main:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:64: 未定義參考到「Py_NoSiteFlag」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:65: 未定義參考到「Py_FrozenFlag」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:66: 未定義參考到「Py_IgnoreEnvironmentFlag」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:67: 未定義參考到「PyImport_FrozenModules」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:93: 未定義參考到「Py_SetPythonHome」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:95: 未定義參考到「Py_SetProgramName」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:96: 未定義參考到「Py_GetProgramFullPath」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:97: 未定義參考到「Py_Initialize」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:98: 未定義參考到「PySys_SetArgv」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 SetPathToSearch:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:196: 未定義參考到「PySys_GetObject」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:199: 未定義參考到「PyList_Insert」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:201: 未定義參考到「PyList_Insert」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:203: 未定義參考到「PyList_Insert」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:205: 未定義參考到「PyList_Insert」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 GetImporter:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:241: 未定義參考到「PyImport_ImportModule」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 ExecuteScript:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:305: 未定義參考到「PyDict_New」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 PopulateInitScriptDict:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:266: 未定義參考到「PyEval_GetBuiltins」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:266: 未定義參考到「PyDict_SetItemString」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:268: 未定義參考到「PyDict_SetItemString」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:270: 未定義參考到「PyDict_SetItemString」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:272: 未定義參考到「PyDict_SetItemString」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:275: 未定義參考到「PyDict_SetItemString」
    build/temp.linux-x86_64-2.7/source/bases/Console.o:/tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:278: 跟著更多未定義的參考到「PyDict_SetItemString」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 ExecuteScript:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:313: 未定義參考到「PyObject_CallMethod」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Common.c:317: 未定義參考到「PyEval_EvalCode」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 FatalError:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 main:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:105: 未定義參考到「Py_Finalize」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 FatalError:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:24: 未定義參考到「PyErr_Print」
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:25: 未定義參考到「Py_FatalError」
    build/temp.linux-x86_64-2.7/source/bases/Console.o: 於函式 FatalScriptError:
    /tmp/pip-build-DRynWy/cx-Freeze/source/bases/Console.c:36: 未定義參考到「PyErr_Print」
    collect2: error: ld returned 1 exit status
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

後來我按照這篇教學文章走,跑去官網下載Source回來


然後解壓縮後,打開 setup.py,尋找:
    if not vars.get("Py_ENABLE_SHARED", 0):

取代:
    if True:

再執行安裝
    sudo python setup.py install

又出現錯誤訊息(以下簡略....):
    ctions -lpthread -ldl -lutil -lm -L/usr/lib -lz -s
    /usr/bin/ld: 找不到 -lz
    collect2: error: ld returned 1 exit status
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

安裝zlib1g-dev套件:
    sudo apt-get install -y zlib1g-dev

再次執行安裝:
    sudo python setup.py install

終於成功了~

【Python】為什麼程式碼裡的中文註解會變成亂碼?

最近剛在學習Python語言,習慣在程式碼裡面寫上註解,有次在寫中文註解時,執行程式後,就出現這個問題:


即使我將編碼指定成 ASNI/UTF-8,使用中文註解都會導致程式無法執行,後來Google一下,才發現原來想要在Python要寫中文註解,需要在程式碼最上方宣告:
    #-*- coding: utf-8 -*-   ←表示使用 utf-8 編碼
    #-*- coding: cp950 -*-   ←表示使用 Big5 編碼(windows 下使用)


【Ubuntu】如何更新FileZilla

已經裝了FileZilla的話,要如何更新呢?

先在官網下載最新版本:



下載下來的壓縮檔,解壓縮後,裡面的 /FileZilla3/bin/ 有3個檔案 fzsftp、fzputtygen、filezilla


全部copy去 /usr/bin/
    sudo mv fzsftp fzputtygen filezilla /usr/bin/

這樣就更新完成了

【Ubuntu】使用 add-apt-repository 指令來移除 PPA 套件庫來源

前陣子為了更新FileZilla,我使用 add-apt-repository 指令增加一個PPA套件庫:
    sudo add-apt-repository ppa:n-muench/programs-ppa2

結果再更新伺服器的套件檔案清單:
    sudo apt-get update

出現下面這個錯誤訊息,E: 某些索引檔未能下載。其已遭略過,或改為使用舊的。
這才發現原來這個PPA套件庫連結已經失效了:


我打算要移除這個PPA套件庫,Google一下, 有人使用ppa-purge 這個指令來移除,結果沒辦法移除,再Google一下,才知道原來 add-apt-repository 這個指令也可以移除:
    sudo add-apt-repository -r ppa:n-muench/programs-ppa2

2014年11月14日 星期五

【Java】JTextArea無法顯示中文字

今天在寫 Java JTextArea 時候,發現不管在上面打中文,或讀取中文文件,中文字都會變成亂碼。

找遍所有資料,修改也沒用,後來才發現,原來是我在 JTextArea 裡的 setFont 這個用來設定字型的方法,選擇不對的字型,才導至無法顯示中文。

我本來是使用「Consolas」字型,後來換成「微軟正黑體」就正常了,不一定要使用「微軟正黑體」,也可以使用「細明體」、「新細明體」等等其他支援中文字型。

2014年11月12日 星期三

【Eclipse】Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.

今天在編譯 Java,想查看 API 時 ,出現「Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.的訊息。

後來查了一下 Google ,設定一下就正常了,以下是設定步驟。

Step 1.先下載你 Java Documentation,我的版本是8,所以下載「Java SE Development Kit 8 Documentation
網址:http://www.oracle.com/technetwork/java/javase/documentation/jdk8-doc-downloads-2133158.html

Step 2.打開 Eclipse ,點擊「Windows」→「Preferences」→「Java」→「Installed JREs」,點「Installed JREs:裡面的項目」→「Edit

Step 3.找到「C:\Program Files\Java\jre1.8.0_25\lib\rt.jar」→「Javadoc Location

Step 4.選擇「Javadoc in archive」,「Archive path:」選擇剛剛下載的「Java SE Development Kit 8 Documentation」;「Path within archive:」選擇「Browse...

Step 5.選擇「api」→「OK

Step 6.點擊「Validate...」→「OK」→「OK

完成

2014年11月3日 星期一

【Eclipse】用Eclipse帶參數給args

怎麼用 Eclipse 帶參數給 args 呢?

Step 1.在專案上,滑鼠按右鍵,選「Properties」。

Step 2.選擇「Run/Debug Settings」→「專案名稱(Vina)」→「Edit...」。

Step 3.點擊「Arguments」,在「Program arguments」內容,輸入參數後,按「OK」。

再按「OK

輸出結果: