SetUp kivy & anaconda with pycharm IDE on OSX

2019-05-24 14:08发布

The problem:

Setting up kivy to work with anaconda in pycharm

What I have done:

Following the directions found at Connecting Kivy with Anaconda (OSX) I have kivy working with anaconda (it launches via the kivy.app, not from conda)

Following those: Setting Up Kivy with various popular IDE's I set up anaconda in Pycharm.

However, I need to use kivy and anaconda in pycharm.
Does someone know how to set it up?


----------------------------------------------------------------------------------

Additional information

It may be useful to know that launching kivy via a conda environment ($ source activate ...) does not work; it throws an import error/package kivy not installed

The final 'bootstrapping script' for the kivy.app is as follows (modified from Connecting Kivy with Anaconda (OSX))

#!/bin/bash
SCRIPT_PATH="${BASH_SOURCE[0]}";
if([ -h "${SCRIPT_PATH}" ]) then
  while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
SCRIPT_PATH=$(python -c "import os; print(os.path.realpath(os.path.dirname('${SCRIPT_PATH}')))")

# activate the virtualenv
# SUPPRESSED
# source ${SCRIPT_PATH}/venv/bin/activate

# setup the environment to not mess with the system
export PYTHONPATH="${SCRIPT_PATH}/kivy:${PYTHONPATH}"
export DYLD_FALLBACK_LIBRARY_PATH="${SCRIPT_PATH}/lib"
export LD_PRELOAD_PATH="${SCRIPT_PATH}/lib"
export GST_REGISTRY="${SCRIPT_PATH}/gst.registry"
export GST_PLUGIN_SCANNER="${SCRIPT_PATH}/gst-plugin-scanner"
export GTK_PATH="${SCRIPT_PATH}/../Frameworks/GStreamer.framework/Versions/Current"
export GST_PLUGIN_SYSTEM_PATH="${SCRIPT_PATH}/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"
export GST_PLUGIN_SYSTEM_PATH="${SCRIPT_PATH}/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"
export GIO_EXTRA_MODULES="${SCRIPT_PATH}/../Frameworks/GStreamer.framework/Versions/Current/lib/gio/modules"
export KIVY_HOME="${SCRIPT_PATH}/.kivy"

# activate the conda environment
# ADDED
source activate kivy

# if an app is available, use it
# SUPPRESSED
# if [ -d "${SCRIPT_PATH}/yourapp" ]; then
#   cd "${SCRIPT_PATH}/yourapp"
#   if [ -f "main.so" ]; then
#       exec ${SCRIPT_PATH}/python -c "import main"
#     exit 1
#   fi
#     if [ -f "main.pyo" ] || [ -f "main.opt-2.pyc" ]; then
#         exec ${SCRIPT_PATH}/python -OO -m main "$@"
#     exit 1
#     else
#         exec ${SCRIPT_PATH}/python -m main "$@"
#     exit 1
#     fi

# ADDED
if [ $# -ne 0 ]; then
    exec python "$@"
else
    exec python
fi

# default drag & drop support
elif [ $# -ne 0 ]; then
        exec ${SCRIPT_PATH}/python "$@"

# start a python shell, only if we didn't double-clicked
# SUPPRESSED
# elif [ "$SHLVL" -gt 1 ]; then
#         exec ${SCRIPT_PATH}/python
fi

I also raised the issue with kivy on github

The following SO questions did not help:

0条回答
登录 后发表回答