How to install pygame automatically when virtual environment is created?

↘锁芯ラ 提交于 2021-02-17 02:06:09

问题


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

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

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

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


回答1:


To create environment:

conda env create -f environment.yml

To generate your yml:

conda env export > environment.yml

More informations in the documentation



来源:https://stackoverflow.com/questions/52059053/how-to-install-pygame-automatically-when-virtual-environment-is-created

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!