I'm just learning python.
So far, I have been using python3 REPL. I wrote a small script that runs fine within REPL.
Within a directory, I ran: pi@raspberrypi:~/Projects/RCTruck $ sudo pip3 install adafruit-circuitpython-motorkit.
Installs successfully.
Within the same directory, I put the same code into a .py file and run the file using python "filename".py, I get error messages saying:
pi@raspberrypi:~/Projects/RCTruck $ python RCTruck01.py
Traceback (most recent call last):
File "RCTruck01.py", line 17, in <module>
from adafruit_motorkit import MotorKit
ImportError: No module named adafruit_motorkit
See attcehd for sample code.
How do I resolve this error message?
Python3 REPL vs python "filename".py
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- JimGig
- Posts: 11
- Joined: Fri Jun 18, 2021 5:39 pm
Python3 REPL vs python "filename".py
- Attachments
-
- 2348_17Y_stepper.txt
- copy of code
- (1.02 KiB) Downloaded 2 times
- tannewt
- Posts: 3304
- Joined: Thu Oct 06, 2016 8:48 pm
Re: Python3 REPL vs python "filename".py
What does `python --version` show? My guess is that `python` is python 2 for you. Try `python3 RCTruck01.py`.
- JimGig
- Posts: 11
- Joined: Fri Jun 18, 2021 5:39 pm
Re: Python3 REPL vs python "filename".py
That works!
Thank you.
Thank you.
Please be positive and constructive with your questions and comments.