I have up top of my script "from prettytable import PrettyTable." However, I get an error stating, "Unable to import 'prettytable.'" I have downloaded prettytable-0.7 and placed it in the directory, but still get the same error message.
Asked
Active
Viewed 7,891 times
1 Answers
1
You need do install the library (https://pypi.org/project/PrettyTable/) via pip, since you are using python3.7, use pip3.7
pip3.7 install prettytable
Then it should work
$ python3.7
>>> from prettytable import PrettyTable
>>>

Devesh Kumar Singh
- 20,259
- 5
- 21
- 40
-
I tried by installing pip which was successful, but I am still getting an invalid syntax. – Dan Apr 10 '19 at 19:12
-
Update the code in the question which shows invalid syntax – Devesh Kumar Singh Apr 10 '19 at 19:17
-
It states: ModuleNotFoundError: No module named 'prettytable' – Dan Apr 10 '19 at 19:19
-
Are you using the same version of python which you used in pip? – Devesh Kumar Singh Apr 10 '19 at 19:20
-
Yes, Python 3.7. – Dan Apr 10 '19 at 19:23
-
I got it to work. I had to change where my file was and I put it in the prettytable folder. – Dan Apr 10 '19 at 19:53