Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
command prompt execution
#1
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
Reply
#2
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(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
Reply
#4
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!!!
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
(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
Reply
#6
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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is the difference between Command Prompt and Sublimes yaoyao22 1 634 Jul-09-2023, 02:56 PM
Last Post: snippsat
  Facing Problem while opening a file through command prompt vlearner 4 1,904 Jan-30-2022, 08:10 AM
Last Post: snippsat
  Noob warning: trying to use pip to install pytest and pep8 in Command Prompt adifrank 4 5,309 Dec-20-2020, 04:23 AM
Last Post: adifrank
  Running Python in Command Prompt Anwar 3 3,080 Nov-15-2020, 03:15 PM
Last Post: snippsat
  starting python from windows command prompt MaartenRo 4 2,806 Sep-04-2020, 12:25 PM
Last Post: MaartenRo
  Will not print in command prompt PandaCode 12 13,043 May-06-2020, 03:48 AM
Last Post: PandaCode
  Script works when executed from command prompt but not when executed in SDP Tippex 0 2,000 Apr-07-2020, 04:26 PM
Last Post: Tippex
  Can read files in command prompt but not IDE Exsul 2 2,155 Sep-13-2019, 01:40 AM
Last Post: jsira2003
  command prompt saisankalpj 8 5,244 Nov-28-2018, 04:13 AM
Last Post: saisankalpj
  Command Prompt Issue benzenegirl 2 2,569 Oct-25-2018, 03:09 PM
Last Post: The_Raven

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020