2017-06-01 60 views
1

今天我試圖刪除一個文件後,我的包(一個python輪)通過pip與-t --target選項安裝。 Post-install script with Python setuptools 我繼承安裝在我的setup.py是這樣的:pip目標和後安裝在setup.py

class PostInstallCommand(install): 
    """Post-installation for installation mode.""" 
    def run(self): 
     install.run(self) 
     # here I am using 
     p = os.path.join(self.install_libbase,"myPackage/folder/removeThisPyc.pyc") 
     if os.path.isfile(p): 
      os.unlink(p) 
     #there is also self.install_platlib and 
     #self.install_purelib which seem to be used by pip distutil scheme 
     #Have not tested those yet 

運行

python setup.py install

當這部作品在安裝文件被刪除。 但通過

pip install path-to-my-wheel.whl

這並不工作,文件仍然存在。

pip install -t /target/dir path-to-my-wheel.whl

不工作要麼... 那麼問題是,什麼是PIP與distutils的和或setuptools的做的和如何使這項工作? 我注意到的另一件事是,PIP似乎不打印任何東西,我打印在我的setup.py在詳細模式? 有沒有看到完整的輸出從python而不是「點子」只是東西?

回答