py2exe 打包python2.6版本以上報錯“由於應用程式配置不正確……”

來源:互聯網
上載者:User

 

  用py2exe對python2.6程式封裝後,在某些機器上無法運行

參考了py2exe官網:

http://www.py2exe.org/index.cgi/Tutorial#Step52

找出瞭解決辦法:

在發布的程式目錄下建立一個檔案名稱為:

Microsoft.VC90.CRT.manifest

內容如下:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><br /><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><br /> <noInheritable></noInheritable><br /> <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity><br /> <file name="msvcr90.dll" /><br /></assembly>

再將dll檔案:msvcr90.dll複製到程式同目錄下,注意msvcr90.dll的版本號碼為

"9.0.21022.8"   

 

添加了這兩個檔案後問題就解決了。

 

說明:

 

  另外,也可以通過安裝vs2008可再發行包來解決運行環境的依賴問題:

http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe

 

安裝完以後可以在所在作業系統的 C:/windows/WinSxS/x86_Microsoft.VC90.CRT_**_9.0.21022.8_x-**(**為任意其它字元) 中找到需要的dll檔案,

另外可以在C:/windows/WinSxS/Manifests 中找到:x86_Microsoft.VC90.CRT_**_9.0.21022.8_**.manifest

對上面的manifest檔案進行修改去掉對msvcm90.dll和msvcp90.dll檔案的依賴即可,因為py2exe上面說我們不需要這兩個檔案。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.