I installed pygame on my Arch Linux machine with the following command:
$ sudo pacman -S python2-pygame
I am using pyenv and the version of Python in my virtual environment for this project is 2.7.11
When I run my program
$ python smartcab/agent.py
here is what I get:
Traceback (most recent call last):
File "smartcab/agent.py", line 2, in <module>
from environment import Agent, Environment
File "/home/alex/machine-learning/projects/smartcab/smartcab/environment.py", line 5, in <module>
from simulator import Simulator
File "/home/alex/machine-learning/projects/smartcab/smartcab/simulator.py", line 4, in <module>
import pygame
ImportError: No module named pygame
How can I solve this please?
On my own Arch Linux machine...
I have created a 2.7.11 virtualenv using pyenv and installed python2-pygame
with pacman. With my virtualenv activated, I couldn't import pygame
from python. So I was able to reproduce your issue.
After that, I tried downloading and compiling pygame's source with python setup.py install
without success. It is complaining about a missing linux/videodev.h
which seems to be (from what I found on the web) deprecated and replaced by linux/videodev2.h
(which is there).
I won't go further, I hope this will help someone finding the solution.