macOS上にpydicomをセットアップするためのメモ
公式のセットアップ手順 はDebian系のLinux環境を前提としている部分があるため、macOS上でセットアップした際の手順を残しておく
環境情報
- macOS Catalina 10.15.6
- Python 3.8.5 on pyenv 1.2.20
※Anacondaは利用しない
セットアップ手順
pydicom
$ pip install pydicom
Optional libraries
$ pip install numpy
$ pip install pillow
CharPyLS
$ pip install cython
$ pip install git+https://github.com/Who8MyLunch/CharPyLS
GDCM
Anacondaなしでは少々手間のかかる部分
Installing the Python GDCM bindings without Conda を参考に、Ubuntu/Debian向けの記述をmacOS向けにアレンジする
$ brew install gdcm
# インストールされた関連ファイルの場所を確認する
$ find /usr -name gdcm.py
/usr/local/lib/python3.8/site-packages/gdcm.py
/usr/local/Cellar/gdcm/3.0.7_1/lib/python3.8/site-packages/gdcm.py
$ find /usr -name "libgdcmCommon.*"
/usr/local/lib/libgdcmCommon.3.0.dylib
/usr/local/lib/libgdcmCommon.3.0.7.dylib
/usr/local/lib/libgdcmCommon.dylib
/usr/local/Cellar/gdcm/3.0.7_1/lib/libgdcmCommon.3.0.dylib
/usr/local/Cellar/gdcm/3.0.7_1/lib/libgdcmCommon.3.0.7.dylib
/usr/local/Cellar/gdcm/3.0.7_1/lib/libgdcmCommon.dylib
# pyenv環境へ関連ファイルをコピー
$ cd ~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/
$ cp /usr/local/lib/python3.8/site-packages/gdcm.py .
$ cp /usr/local/lib/python3.8/site-packages/gdcmswig.py .
$ cp /usr/local/lib/python3.8/site-packages/_gdcmswig* .
$ cp /usr/local/lib/libgd* .
Pythonのプロンプト上で import gdcm
してエラーが出なければOK
Author And Source
この問題について(macOS上にpydicomをセットアップするためのメモ), 我々は、より多くの情報をここで見つけました https://qiita.com/kiakiraki/items/8ce8bc1c71129091e906著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .