C++、pythonまわりの環境構築覚え書き

homebrewのインストール

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

pythonのインストール

brew install python
python3 --version
Python 3.7.2
pip3 list
Package             Version
------------------- --------
appnope             0.1.0
backcall            0.1.0
bleach              3.0.2
cycler              0.10.0
decorator           4.3.0
defusedxml          0.5.0
entrypoints         0.2.3
h5py                2.9.0
imageio             2.4.1
ipykernel           5.1.0
ipython             7.2.0
ipython-genutils    0.2.0
ipywidgets          7.4.2
jedi                0.13.2
Jinja2              2.10
jsonschema          2.6.0
jupyter             1.0.0
jupyter-client      5.2.4
jupyter-console     6.0.0
jupyter-core        4.4.0
Keras               2.2.4
Keras-Applications  1.0.6
Keras-Preprocessing 1.0.5
kiwisolver          1.0.1
MarkupSafe          1.1.0
matplotlib          3.0.2
mistune             0.8.4
moviepy             0.2.3.5
nbconvert           5.4.0
nbformat            4.4.0
netifaces           0.10.6
notebook            5.7.4
numpy               1.15.4
opencv-python       3.4.5.20
pandas              0.23.4
pandocfilters       1.4.2
parso               0.3.1
pexpect             4.6.0
pickleshare         0.7.5
Pillow              5.3.0
pip                 18.1
prometheus-client   0.5.0
prompt-toolkit      2.0.7
ptyprocess          0.6.0
Pygments            2.3.1
pyparsing           2.3.0
python-dateutil     2.7.5
pytz                2018.7
PyYAML              3.13
pyzmq               17.1.2
qtconsole           4.4.3
scikit-learn        0.20.2
scipy               1.2.0
Send2Trash          1.5.0
setuptools          40.6.3
simpy               3.0.11
six                 1.12.0
socketio            0.1.6
terminado           0.8.1
testpath            0.4.2
tornado             5.1.1
tqdm                4.28.1
traitlets           4.3.2
wcwidth             0.1.7
webencodings        0.5.1
wheel               0.32.3
widgetsnbextension  3.4.2
  • tensorflow,pickleをinstallしようとすると、対応バージョンのエラーが出る。

対応した頃に追加でインストールする必要あり。

pip3 install tensorflow
Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
pip3 install pickle
Collecting pickle
  Could not find a version that satisfies the requirement pickle (from versions: )
No matching distribution found for pickle

→python3.7系はまだtensorflowが対応していない。anacondaで3.6系をインストールして必要なパッケージを追加する方向に。
blog.mktia.com
jupyter等で対応するversionのpythonがない旨のエラーが出る場合は以下で対処。
atsuizo.hatenadiary.jp



Command Line Toolのインストール

www.programing-style.com

C関連のインストール

  • Xcodeをインストール
  • openssl, cmake, libuvをインストール

リンク先のinstall-mac.shを実行する.
PCの中にopensslを2つインストールしてしまっている・・・?
opensslのverをfinderで直接確認し、cmakeに渡すpathを設定するとうまく行った。
github.com

ここまでの設定でUdacityのTerm2のシミュレータ動作確認できた。

Ipopt、CppADのインストール

以下に従う
github.com
途中ipoptのインストールで、

brew tap brewsci/science
brew install ipopt --with-openblas

をすると、mumpが見つからないとのエラーが出る。

brew tap udacity/CarND-MPC-Project https://github.com/udacity/CarND-MPC-Project
brew install ipopt --with-openblas

で対応する。