hi Ivan,
bad style, just missing the main required info,
but i was able to get the same error:
Code: Select all
pi@RPI3:~/projects/cocos $ python helloWorld.py
Cannot import cocos. Did you run 'pip install cocos2d' ?
Traceback (most recent call last):
File "helloWorld.py", line 10, in <module>
class HelloWorld(cocos.layer.Layer):
NameError: name 'cocos' is not defined
pi@RPI3:~/projects/cocos $
when i started with python .. === python2x
but not installed with pip
( like you i used
pip3 so must start with
python3 )
Code: Select all
pi@RPI3:~/projects/cocos $ pip3 install cocos2d
Collecting cocos2d
Downloading https://www.piwheels.org/simple/cocos2d/cocos2d-0.6.5-py3-none-any.whl (288kB)
100% |████████████████████████████████| 296kB 651kB/s
Collecting six>=1.4 (from cocos2d)
Downloading six-1.11.0-py2.py3-none-any.whl
Collecting pyglet>=1.2 (from cocos2d)
Downloading pyglet-1.3.1-py2.py3-none-any.whl (1.0MB)
100% |████████████████████████████████| 1.0MB 274kB/s
Collecting future (from pyglet>=1.2->cocos2d)
Downloading https://www.piwheels.org/simple/future/future-0.16.0-py3-none-any.whl (489kB)
100% |████████████████████████████████| 491kB 309kB/s
Installing collected packages: six, future, pyglet, cocos2d
Successfully installed cocos2d-0.6.5 future-0.16.0 pyglet-1.3.1 six-1.11.0
pi@RPI3:~/projects/cocos $
so you miss to show the
- - install line
- - start line

beginning with
IDLE3 can help
anyhow possibly better to do the full install like
here
start with download zip file ...
what includes docs and samples.