1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HTMをPython3環境で動かす

1
Posted at

背景

NuPICを他のモジュールと組み合わせて使いたくなったが、そちらがPython3でしかインストールができないことが判明。
仕方なくNuPICの方をPython3に対応させることにした。
今回はHTM Communityの有志の方が作成しているhtm.coreをソースからビルドして利用する。

実行環境

・Ubuntu18.04
・gitはインストール済み

インストール方法

①Cmakeをインストール

$ sudo apt install cmake -y

②Virtualenvをインストール

$ sudo apt install virtualenv

③htm.coreリポジトリをgit cloneする

$ git clone https://github.com/htm-community/htm.core
$ cd ./htm.core

④venv環境を作成

$ virtualenv --system-site-packages -p python3 ./venv
$ source ./venv/bin/activate

⑤必要なpythonツールをそろえる

$ python -m pip install --user --upgrade pip setuptools setuptools-scm wheel
$ python -m pip install --no-cache-dir --user -r bindings/py/packaging/requirements.txt

⑥Pythonパッケージとしてビルド

$ python setup.py install --user --force

割と時間がかかります。

⑦動作確認

$ python
>>> import htm           # Python Library
>>> import htm.bindings  # C++ Extensions

エラー等でなければ完了です。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?