Python works in PyCharm but not from terminal

后端 未结 7 765
你的背包
你的背包 2020-12-31 03:06

I recently figured out how to import modules for unittesting in python. As a solution to this, I use:

sys.path.append(os.path.abspath(os.path.join(os.path.di         


        
相关标签:
7条回答
  • 2020-12-31 03:53

    To add to similar answers here, PyCharm is doing some extra config for you before running your script. If adding your sources root to PYTHONPATH doesn't work then examine your run configuration in PyCharm for the script in question, there will likely be some more behind the scenes magic at play.

    0 讨论(0)
提交回复
热议问题