I have installed Simpy, and I use Python 3.5. I have the same error:
>>> env = simpy.Environment()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
env = simpy.Environment()
AttributeError: module 'simpy' has no attribute 'Environment'
It lets me import simpy, but when I do env = simpy.Environment()
it prints this error.
I have tried uninstalling it, reinstalling, using in the terminal, in the Python's IDLE, in other IDLEs...
The whole code is (from the tutorial):
>>> def car(env):
... while True:
... print('Start parking at %d' % env.now)
... parking_duration = 5
... yield env.timeout(parking_duration)
...
... print('Start driving at %d' % env.now)
... trip_duration = 2
... yield env.timeout(trip_duration)
>>> import simpy
>>> env = simpy.Environment()
And then the error pops-up.
EDIT (solved):
I had a file named simpy.py in the same folder. I removed it, and now works perfectly. The code now is:
>>> def car(env):
... while True:
... print('Start parking at %d' % env.now)
... parking_duration = 5
... yield env.timeout(parking_duration)
...
... print('Start driving at %d' % env.now)
... trip_duration = 2
... yield env.timeout(trip_duration)
>>> import simpy
>>> env = simpy.Environment()
>>> env.process(car(env))
>>> env.run(until=15)
And the output:
Start parking at 0
Start driving at 5
Start parking at 7
Start driving at 12
Start parking at 14