Python Forum
command prompt execution - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: command prompt execution (/thread-11373.html)



command prompt execution - saisankalpj - Jul-05-2018

My program of python gets executed from pycharm.But the same doesnt happen when i do in command prompt as i get the error like"cannot import Method", as i have used import statements like "import abc from *".How do i resolve it


RE: command prompt execution - buran - Jul-05-2018

what OS? How is PyCharm interpreter set-up? Do you have more than one python installation?
Please, post the entire traceback that you get. We need to see the whole thing. Do not just give us the last line.
Take a time to read What to include in a post


RE: command prompt execution - saisankalpj - Jul-05-2018

(Jul-05-2018, 03:30 PM)buran Wrote: what OS? How is PyCharm interpreter set-up? Do you have more than one python installation?
Please, post the entire traceback that you get. We need to see the whole thing. Do not just give us the last line.
Take a time to read What to include in a post

i am using windows 10.I am setting the interpreter in pycharm by giving path like "C:/Python27" in the pycharm interpreter.i am using python 2.7.14.My error is

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named openpyxl


RE: command prompt execution - buran - Jul-05-2018

if it runs in pycharm and not from command prompt then you have more than one interpreter and openpyxl is installed for the one used in PyCharm, but not for the other one used from command prom
and for the last time - start using proper tags, in this case - error tags!!!


RE: command prompt execution - saisankalpj - Jul-05-2018

(Jul-05-2018, 04:22 PM)buran Wrote: if it runs in pycharm and not from command prompt then you have more than one interpreter and openpyxl is installed for the one used in PyCharm, but not for the other one used from command prom
and for the last time - start using proper tags, in this case - error tags!!!

i am using same interpreter not a different one.what do you mean by openpyxl not installed in cmd but not pycharm


RE: command prompt execution - buran - Jul-05-2018

openpyxl is external package, it must be installed. Every installation of a package is for particular interpreter. you don't install it for pycharm or cmd. You just setup which interpreter to be used in pycharm. or you decide which one to use when execute script from command line. If it runs for pycharm, then it is installed for the particular interpreter that is used in pycharm. If it doesn't find it when running the script from command prompt - you use different interpreter.