2017-09-12 60 views
-1

我只是將我的Python project重構爲單個頂層模塊而不是包。pip是否可以安裝單個模塊項目?

然而,PIP安裝不工作了:我得到它說的錯誤:

(forcelib_test) C:\code>pip install git+https://github.com/blokeley/forcelib 
Collecting git+https://github.com/blokeley/forcelib 
    Cloning https://github.com/blokeley/forcelib to c:\users\tomoak~1\appdata\local\temp\pip-t10zegic-build 
    Complete output from command python setup.py egg_info: 
    running egg_info 
    creating pip-egg-info\forcelib.egg-info 
    writing pip-egg-info\forcelib.egg-info\PKG-INFO 
    writing dependency_links to pip-egg-info\forcelib.egg-info\dependency_links.txt 
    writing requirements to pip-egg-info\forcelib.egg-info\requires.txt 
    writing top-level names to pip-egg-info\forcelib.egg-info\top_level.txt 
    writing manifest file 'pip-egg-info\forcelib.egg-info\SOURCES.txt' 
    warning: manifest_maker: standard file '-c' not found 

    error: package directory 'forcelib' does not exist 

我並不想安裝一個稱爲forcelib,只有一個模塊。 setup.py腳本正確使用py_modules參數,而不是packages

是否可以安裝單個模塊,還是必須恢復使用包?

注意:this question是一個不同的問題。他們想要安裝一個額外的文本文件。我只想安裝單個Python模塊。事實上,這個問題意味着什麼,我試圖做無我有

+0

可能[設置setup.py用於打包單個.py文件和單個數據文件而無需創建任何文件夾]的副本(https://stackoverflow.com/questions/12461603/setting-up-setup-py-for - 單一的py-file-and-a-single-data-file-wi) – Sraw

+0

我不認爲它是重複的。引用的問題是關於如何安裝_additional supporting_文件。的確,這個問題意味着安裝一個Python模塊應該可以工作。是否可以只安裝一個Python模塊,而不是一個包?我更新了我的問題以解決潛在的重複問題。 – blokeley

+1

[PIP install「error:package directory'X'does not exist」]的可能重複](https://stackoverflow.com/questions/25336150/pip-install-error-package-directory-x-does-not-exist ) – phd

回答

0

錯誤應該工作,我需要使用

py_modules=['forcelib'] 

而不是什麼我這是

py_modules=['forcelib.py']