我有一個更復雜的項目,我正在努力工作,爲了簡化事物的本質以理解事情爲什麼會失敗,我組成了以下項目(屏幕截圖來自Eclipse)爲什麼我的Python安裝腳本失敗?
這是運行setup.py sdist 注意,這裏有兩個項目前的目錄結構 - 這個簡單的項目(Deploy_Test)我使用的測試分發過程,幷包含的共同項目類和函數我希望分享的軟件包項目。在右邊是我的setup.py文件的內容
這裏是運行setup.py sdist的輸出。注意紅色框末尾的錯誤行:
以下是結果。請注意創建的空文件夾(再次由紅色框標出)。在右邊你可以看到清單文件的內容創建:
我最初的想法是,儘管我通過package_dir參數指的是引用的「類」和「功能」包在setup.py,這在某種程度上造成了問題。
爲了測試這一點,我複製並粘貼在「類」和「功能」包入Deploy_Test文件夾,刪除從setup.py的package_dir參數,去掉了清單文件空文件夾,並重新運行setup.py sdist,並得到了類似的結果 - 以前的「common」目錄丟失,但「classes」和「functions」目錄現在出現在Deploy_Test-1.0目錄中,但仍爲空,原樣Deploy_Test子目錄下面Deploy_Test-1.0。
我也仍然收到「錯誤的功能」錯誤信息相同的錯誤。我仍然不明白它是如何告訴我的。
感謝有這方面的意見...
越來越@ Cartroo的意見,在這之後,我又重新跑在我的本地HD(NTFS)具有相同結構的過程。確實避免了「錯誤的功能」錯誤,但現在別的東西正在搞砸了。下面是從setup.py sdist
running sdist
running check
writing manifest file 'MANIFEST'
creating Deployment Test-1.0
creating Common
creating Common\classes
creating Common\functions
creating Deployment Test-1.0\Deploy_Test
making hard links in Deployment Test-1.0...
hard linking setup.py -> Deployment Test-1.0
hard linking ..\Common\classes\__init__.py -> Deployment Test-1.0\..\Common\classes
hard linking ..\Common\classes\fw_ftp.py -> Deployment Test-1.0\..\Common\classes
hard linking ..\Common\functions\__init__.py -> Deployment Test-1.0\..\Common\functions
hard linking ..\Common\functions\fw_date.py -> Deployment Test-1.0\..\Common\functions
hard linking ..\Common\functions\fw_db.py -> Deployment Test-1.0\..\Common\functions
hard linking ..\Common\functions\fw_file.py -> Deployment Test-1.0\..\Common\functions
hard linking ..\Common\functions\fw_file_io.py -> Deployment Test-1.0\..\Common\functions
hard linking ..\Common\functions\fw_string.py -> Deployment Test-1.0\..\Common\functions
hard linking Deploy_Test\Deploy_Test.py -> Deployment Test-1.0\Deploy_Test
hard linking Deploy_Test\__init__.py -> Deployment Test-1.0\Deploy_Test
creating dist
creating 'dist\Deployment Test-1.0.zip' and adding 'Deployment Test-1.0' to it
adding 'Deployment Test-1.0\PKG-INFO'
removing 'Deployment Test-1.0' (and everything under it)
error removing Deployment Test-1.0: Deployment Test-1.0\Deploy_Test\Deploy_Test.py: The system cannot find the file specified
error removing Deployment Test-1.0: Deployment Test-1.0\Deploy_Test\__init__.py: The system cannot find the file specified
error removing Deployment Test-1.0: Deployment Test-1.0\Deploy_Test: The directory is not empty
error removing Deployment Test-1.0: Deployment Test-1.0\setup.py: The system cannot find the file specified
error removing Deployment Test-1.0: Deployment Test-1.0: The directory is not empty
包含在DIST唯一輸出/部署Test-1.0.zip是單個文件:PKG-INFO 所有的錯誤要求的文件找不到全部存在部署測試-1.0目錄。該常見項目文件夾中的所有被複制到下面的/ Deploy_Test文件夾自己的子文件夾,和MANIFEST文件似乎是正確的(它包括了所有包含在setup.py指定的包模塊)
哈!有趣!要回USB驅動器,並加入加入兩行的setup.py由@Cartroo建議後,我沒有錯誤 - 甚至沒有錯誤,我是讓我的關於它找不到文件的本地高清。
我不知道如果我完全脫離險境,因爲dist文件夾包含僅在其中的Deploy_Test.py文件的zip文件。過程中複製的公共/文件夾到Deploy_Test \文件夾,幷包含在清單文件到原來的普通/文件夾的內容的參考(它存在側支到Deploy_Test文件夾),但沒有這些模塊中的得到了包括到DIST文件夾,我期待。但是,考慮到我已經不知道什麼是成功的Python發行的樣子,我可能會做出不正確的假設
謝謝 - 有趣的是,我從USB驅動器運行此(它可以讓我在辦公室這個工作,要麼我的臺式電腦上,或在我的家用筆記本)。在提到試圖從USB驅動器運行它之前,我首先想到的是將結構複製到本地HD(即NTFS),以查看是否可以避免此問題。我會先試一試,然後將你建議的兩行添加到我的setup.py中,如果任何修復程序糾正了問題,請回報。 –
好吧,這是有道理的 - 如果你還沒有重新格式化它,USB驅動器一般都預先格式化爲FAT或VFAT,不支持硬鏈接。一旦你在NTFS上試過了,如果你可以在這裏發佈你的發現,我可以更新我的答案,以對其他任何有此問題的人作出更有用的迴應。 – Cartroo
是的 - 我剛剛看完昨晚的檢查,USB驅動器是FAT32。在我的本地HD上查看我對原始文章的編輯以獲得嘗試結果。 –