创建虚拟环境时如何自动安装pygame? [英] How to install pygame automatically when virtual environment is created?

查看:64
本文介绍了创建虚拟环境时如何自动安装pygame?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个虚拟环境 testenv 来运行一些 python 项目.这是我的 environment.yml 文件:

I am creating a virtual environment testenv to run some python project. This is my environment.yml file:

name: testenv
channels:
- !!python/unicode
  'defaults'
dependencies:
- python=3.5
- pip==9.0.1
- numpy==1.12.0
- jupyter==1.0
- matplotlib==2.0.0
- scikit-learn==0.18.1
- scipy==0.19.0
- pandas==0.19.2
- pip:
  - tensorflow==1.1.0
  - keras==2.0.4
  - plotly==2.7.0

我想将 pygame 添加到这个环境中.但是,如果我将 pygame==1.9.4 添加到 dependenciespip,则创建虚拟环境失败:

I want to add pygame to this environenment. However, if I add pygame==1.9.4 to dependencies or pip, then the creation of a virtual environment fails:

conda env create

所以我应该source activate testenv然后手动安装pygame,但是不是很方便.

Therefore I should source activate testenv and then install pygame manually, but it's not very convenient.

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
pip install pygame

有人试过在虚拟环境中自动安装 pygame 吗?

Has anybody tried installing pygame in the automated way in the virtual environment?

推荐答案

创建环境:

conda env create -f environment.yml

要生成您的 yml:

conda env export > environment.yml

文档中的更多信息

这篇关于创建虚拟环境时如何自动安装pygame?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆