Pycharm gets error “can't find '__main__' module”

后端 未结 7 674
轻奢々
轻奢々 2021-02-02 14:21

Whenever I try to run script via Virtualenv in pycharm, i get this error:

C:\\Users\\Costello\\PycharmProjects\\test\\venv\\Scripts\\python.exe C:/Users/Costello         


        
7条回答
  •  时光说笑
    2021-02-02 14:29

    In your Pycharm:

    1. Select Run - Edit Configurations
    2. In Configuration tabs, select Module name in option Choose target to run and type your python file's name
    3. Click Apply and OK button

    Or the simple way is when you run your code for first time (on a new file) just type keyboard Alt+Shift+F10 to run and save the configuration. On the second time (after configuration is saved) just type Alt+F10 to run your code.

提交回复
热议问题