python fail in Cygwin? 自己裝一個吧

使用cygwin當作你在windows環境裡的unix-like介面, 如果遇到指令執行錯誤,像是python太舊的問題, 這裡有個workaround的方式提供~

1,錯誤發生:

File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

2. 分析一下是否環境變數路徑順序的問題
Vincent@VINCENTC_PC /cygdrive/d/codebase
$ python --version
Python 2.6.5

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ which python
/usr/bin/python

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ echo $path

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Perl/site/bin:/cygdrive/c/Perl/bin:/cygdrive/c/Program Files/ARM/bin/win_32-pentium:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft ASP.NET/ASP.NET Web Pages/v1.0:/cygdrive/c/Program Files/Windows Kits/8.0/Windows Performance Toolkit:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files/ARM/RVCT/Programs/4.1/713/win_32-pentium:/cygdrive/c/Program Files/ARM/RVI/Tools/4.2/39/programs/win_32-pentium:/cygdrive/c/Program Files/ARM/RVD/Core/4.1.2/38/win_32-pentium/bin:/cygdrive/c/Program Files/ARM/Utilities/FLEXlm/10.8.5.0/1/win_32-pentium:/cygdrive/c/Python27:/cygdrive/c/Program Files/Microsoft Visual Studio 11.0/VC/bin:/usr/lib/lapack

(看得出來cygwin創建的環境變數/usr/local/bin:/usr/bin優先於我自己安裝的新版/cygdrive/c/Python27)

3.備份舊版python, 讓系統找到後面環境變數裡的指令python

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ mv /usr/bin/python /usr/bin/pythonBAK

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ which python
/cygdrive/c/Python27/python

4. Build OK

發表迴響

Copy Protected by Chetan's WP-Copyprotect.