スクリプトはnumpy
,、matplotlib
をインポートする必要がありましたが、Sklearnをインストールできませんでした。私の質問http://https://stackoverflow.com/questions/38733220/difference-between-scikit-learn-and-sklearnへの非常に役に立つ応答は、私がnumpyを再インストールする必要があると説明しました。 OS X 10.11 SIPが現在のnumpyのアンインストールを妨げたため、pipを使用してnumpyを更新できませんでした。 mfripp http://https://apple.stackexchange.com/questions/209572/how-to-use-pip-after-the-os-x-el-capitan-upgradeのpipとSIPに関する質問に対する非常に有益な答えは、この問題に対する詳細な解決策を提供しました。私はそれらの指示を正確に守り、、matplotlib
、scipy
およびsklearn
をすべてのユーザーに再インストールするためにpip
を使用しました。 matplotlibをインポートするPythonスクリプトは成功しましたが、スクリプトのバイナリバイナリは失敗します
python DistMatPlot.py Random10A.matrix Random10A.pdf
スクリプトが完全に実行コマンドを使用して、私の完成したスクリプトを実行したとき。
しかし、私はいつも見た:私は、など2秒の遅延numpyの、matplotlibのを、更新する前に他のmatplotlibのスクリプトを見たことがなかった
"/Library/Python/2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment. warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')"
は穏やかに迷惑でした。
pyinstallerを使ってフリーズしたバイナリをコンパイルしましたが、コンパイル中に上記と同様のメッセージが表示されました。 はコマンドで失敗しましたフローズンバイナリの実行:
./DistMatPlot Random10A.matrix Random10A.pdf
は、次のように生成:
/var/folders/8x/7_zp_33h8xj6td0059b72p9h0000gp/T/_MEIhIysTV/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment. Traceback (most recent call last): File "", line 13, in File "/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module exec(bytecode, module.dict) File "matplotlib/pyplot.py", line 114, in File "matplotlib/backends/init.py", line 32, in pylab_setup File "/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module exec(bytecode, module.dict) File "matplotlib/backends/backend_macosx.py", line 24, in File "/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 546, in load_module module = imp.load_module(fullname, fp, filename, ext_tuple) RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ DistMatPlot returned -1
私は同様の質問を見て、無駄にその推奨解決策を試してみました。
(1)matplotlibは、実行するたびにフォントキャッシュを再構築する必要があるのはなぜですか?
(2)スクリプト自体が成功したときにフリーズしたバイナリが失敗するのはなぜですか? pyinstallerの実行時に-F以外のオプションが必要ですか?
[anaconda](https://www.continuum.io/downloads)を使用すると、一般的なソフトウェア(バイナリの提供)のインストールがはるかに簡単になりましたか?私はOS Xのユーザーではないので、ここでは他のヒントを教えてもらえませんが、Linuxと比較してOS Xの多くのインストール/コンパイルの問題を熟知しています(C++やFortranなどの複雑なソフトウェアに関する)。 matplotlibについて:これはフォントキャッシュのことを1回だけしています! – sascha