Python setuptools のカスタム インストール後スクリプト
質問:
setuptoolsのsetup.pyファイルの一部としてインストール後のスクリプトを作成しますか?このスクリプトは、 python setup.py install local または pip install
回答:
要件:
このソリューションは、ソース ディストリビューションからのインストール中にのみアクティブになることに注意してください ( zip、tarball)、または編集可能モードでインストールする場合。バイナリ ホイール (.whl) からインストールする場合は実行されません。
透過的な解決策:
必要な動作を実装するには、setup.py ファイルを変更する必要があります。追加のファイルを作成します。開発/編集可能モードとインストール モードの別々のシナリオを検討する必要があります:
1.開発モード:
setuptools.command.develop を拡張し、インストール後のスクリプトを含む PostDevelopCommand クラスを作成します:
from setuptools import setup from setuptools.command.develop import develop class PostDevelopCommand(develop): def run(self): develop.run(self) # Your post-installation script or function can be called here
2.インストール モード:
setuptools.command.install を拡張し、インストール後のスクリプトを含む PostInstallCommand クラスを作成します:
from setuptools import setup from setuptools.command.install import install class PostInstallCommand(install): def run(self): install.run(self) # Your post-installation script or function can be called here
3. setup.py との統合:
setup.py の setup() 関数に次の行を追加します:
setup( ... cmdclass={ 'develop': PostDevelopCommand, 'install': PostInstallCommand, }, ... )
これにより、インストール後のスクリプトの実行が有効になります。または、ソースからのインストール時または編集可能モードでのインストール時に自動的に機能します。
以上がPython setuptools でインストール後のスクリプトを実行できますか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

pythonusesahybridmodelofcompilation andtertation:1)thepythoninterpretercompilessourcodeodeplatform-indopent bytecode.2)thepythonvirtualmachine(pvm)thenexecuteTesthisbytecode、balancingeaseoputhswithporformance。

pythonisbothintersedand compiled.1)it'scompiledtobytecode forportabalityacrossplatforms.2)bytecodeisthenは解釈され、開発を許可します。

loopsareideal whenyouwhenyouknumberofiterationsinadvance、foreleloopsarebetterforsituationsは、loopsaremoreedilaConditionismetを使用します

henthenumber ofiterationsisknown advanceの場合、dopendonacondition.1)forloopsareideal foriterating over for -for -for -saredaverseversives likelistorarrays.2)whileopsaresupasiable forsaresutable forscenarioswheretheloopcontinupcontinuspificcond

pythonisnotpurelyLepted; itusesahybridapproachofbytecodecodecodecodecodecodedruntimerttation.1)pythoncompilessourcodeintobytecode、whodythepythonvirtualmachine(pvm).2)

ToconcatenateListsinpythothesheElements、使用:1)Operatortokeepduplicates、2)asettoremoveduplicates、or3)listcomplunting for controloverduplicates、各メトドハスディフェルフェルフェントパフォーマンスアンドソーダーインプリテーション。

pythonisantertedlanguage、useaseofuseandflexibility-butfactingporformantationationsincriticalapplications.1)解釈されたlikepythonexecuteline-by-lineを解釈します

Useforloopswhenthenumberofiterationsisknowninadvance、andwhiloopswheniterationsdependonacondition.1)forloopsareidealforsecenceslikelistoranges.2)


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

WebStorm Mac版
便利なJavaScript開発ツール

SublimeText3 中国語版
中国語版、とても使いやすい

mPDF
mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール
