设置kivy
以使用anaconda
中的pycharm
根据Connecting Kivy with Anaconda (OSX)上的说明,我kivy
与anaconda
合作(通过kivy.app
启动,而非conda
启动)
遵循这些:Setting Up Kivy with various popular IDE's我在anaconda
设置了Pycharm
。
但是,我需要在kivy
中使用anaconda
和 pycharm
。
有人知道如何设置吗?
----------------------------------------------------------------------------------
知道通过conda environment
($ source activate ...
)启动kivy不起作用可能会有用;它抛出一个import error/package kivy not installed
kivy.app
的最终'引导脚本'如下(从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
我在github上也raised the issue with kivy