简体   繁体   English

如何在 Anaconda 中安装 Kivy?

[英]How to install Kivy within Anaconda?

I'm new with Python so having a bit of trouble.我是 Python 新手,所以遇到了一些麻烦。 Also on Ubuntu.也在 Ubuntu 上。 Anyway, when I install Kivy the normal way (Kivy repositories), it installs the package somewhere else on my system and not with the rest of the packages in the Anaconda3 folder.无论如何,当我以正常方式(Kivy 存储库)安装 Kivy 时,它会将软件包安装在我系统上的其他位置,而不是 Anaconda3 文件夹中的其余软件包。 How can I install Kivy within the Anaconda3 folder so that I can use it with the rest of the packages in Anaconda?如何在 Anaconda3 文件夹中安装 Kivy,以便我可以将它与 Anaconda 中的其余软件包一起使用?

I found a couple of Kivy packages when I searched the Anaconda packages with当我搜索 Anaconda 软件包时,我发现了几个 Kivy 软件包

anaconda search -t conda kivy

but I am not sure which one to use and if they are the same as the official Kivy packages?但我不确定要使用哪一个,以及它们是否与 Kivy 官方软件包相同? I guess I'm just looking for an explanation.我想我只是在寻找解释。

Since you are using anaconda3, you could install kivy on your own virtual environment.由于您使用的是 anaconda3,您可以在自己的虚拟环境中安装 kivy。

To install kivy on a virtual env, you have to install some necessary packages.要在虚拟环境中安装 kivy,您必须安装一些必要的软件包。 Run the command:运行命令:

sudo apt-get install -y \
python-pip \
build-essential \
git \
python \
python-dev \
ffmpeg \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libportmidi-dev \
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev

Creating a env for kivy in conda, run this command:在 conda 中为 kivy 创建 env,运行以下命令:

conda create kivyinstall

kivyinstall is just a name for the env. kivyinstall 只是 env 的名称。

run the below command to activate the env:运行以下命令以激活 env:

source activate kivyinstall

Now make sure Pip, Virtualenv and Setuptools are fully updated.现在确保 Pip、Virtualenv 和 Setuptools 已完全更新。

you can use conda install or pip install once you are in the env.进入环境后,您可以使用 conda install 或 pip install 。

sudo pip install --upgrade pip virtualenv setuptools

Install Cpython version 0.23安装 Cpython 版本 0.23

pip install Cython==0.23

now install the stable version of kivy in your env:现在在你的环境中安装稳定版本的 kivy:

pip install kivy

Some linux version throws some error when installing ffmpeg package, in place of ffmpeg you could use "libav-tools"某些 linux 版本在安装 ffmpeg 包时会抛出一些错误,您可以使用“libav-tools”代替 ffmpeg

conda install --channel https://conda.anaconda.org/jiayi_anaconda kivy use above code for python3. conda install --channel https://conda.anaconda.org/jiayi_anaconda kivy 将上面的代码用于python3。 I have found this channel using terminal, and it solved my issue.我使用终端找到了这个频道,它解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM