Script running in PyCharm but not from the command line

后端 未结 4 1193
孤城傲影
孤城傲影 2020-12-01 14:33

When I try to run my program from the PyCharm IDE everything works fine but if I type in Fedora:

python myScript.py

in a shell prompt I get

4条回答
  •  粉色の甜心
    2020-12-01 14:56

    Adding this worked for me:

    from os import sys, path
    sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
    

提交回复
热议问题