Skip to content

Instantly share code, notes, and snippets.

@Sitin
Last active February 1, 2022 19:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sitin/b035dd6926a51248d77768ba724c37de to your computer and use it in GitHub Desktop.
Save Sitin/b035dd6926a51248d77768ba724c37de to your computer and use it in GitHub Desktop.
Install Autodesk's Python FBX SDK for Homebrew Python 2.7 & 3.x
function link_fbx_sdk() {
INTERPRETER=$1
SITE_PACKAGES=`$INTERPRETER -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
PYTHON_LIB="${2}"
echo "[Installing] '$PYTHON_LIB' to '$SITE_PACKAGES'"
pushd $SITE_PACKAGES
for file in "${PYTHON_LIB}"/*
do
filename=$(basename "${file}")
echo "[Linking] $filename to $SITE_PACKAGES"
rm -f $SITE_PACKAGES/$filename
ln -s "${file}" $SITE_PACKAGES/$filename
done
popd
echo "[Testing] ${PYTHON_LIB}"
$INTERPRETER -c "import FbxCommon"
}
function install_fbx_sdk() {
FBX_SDK_URL=http://download.autodesk.com/us/fbx/2017/2017.1/fbx20171_fbxpythonsdk_mac.pkg.tgz
TMP_DIR=/tmp/fbx_install
PKG_NAME=fbx20171_fbxpythonsdk_macos.pkg
mkdir -p $TMP_DIR
wget -O $TMP_DIR/fbxpythonsdk_mac.pkg.tgz $FBX_SDK_URL
tar -C $TMP_DIR -zxvf $TMP_DIR/fbxpythonsdk_mac.pkg.tgz
sudo installer -pkg $TMP_DIR/$PKG_NAME -target /
link_fbx_sdk `which python2` "${PYTHON27_LIB}"
link_fbx_sdk `which python3` "${PYTHON3X_LIB}"
rm -rf $TMP_DIR
}
install_fbx_sdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment