'PyCharmの'問題で '__main__'モジュールが見つかりません 'の解決策



Solution Thecant Find__main__module Inproblem Pycharm



Pythonを学びましょう

PyCharmで「が見つかりません」 メイン 「モジュールイン」問題の解決策

Python language, I have wanted to learn for a long time, but I can't make up my mind. Now I stay at home and I can finally learn it. Everything went smoothly. I downloaded and installed Python 3.7. I wrote a 'Hello World' using IDLE. I think this tool is pretty good. I searched the Internet Python Dajia when I had time and found that many people are introducing PyCharm and are very interested. After reading the introduction of PyCharm, I was fascinated by its powerful features. I immediately downloaded the PyCharm Community Edition 2019.3.3 x64 version according to Dajia’s instructions. Dajia said that this is a community edition, free, and has been used for more than two years. , I feel pretty good. Regardless, I'm a Xiaobai anyway, it's best for free. Installation, everything went well, it is an English version, I am too good at English, I want to convert to Chinese, downloaded the Chinese package resources_cn.jar, according to the instructions of Dajiamen, put it in the Python installation directory lib folder, re-run PyCharm, Haha, I really saw Chinese. Come to 'Hello World' immediately, run, unsuccessful, the following prompt appears:

C: Users Administrator AppData Local Programs Python Python37-32 python.exe: ‘が見つかりません メイン 'F:/ python /'の ’モジュール
プロセスは終了コード1で終了しました



I began to wonder if the configuration was wrong. I clicked the 'File' menu and selected 'Configuration', but there was no response. What's the matter? After continuing to Baidu, some netizens finally said that they didn’t respond because they downloaded the Chinese package. Just remove the Chinese package first. If so, put the resources_cn.jar aside first, and then re-run PyCharm. Finally You can open the configuration file. Configure the Python path as shown by the red line as shown below, click [Apply], PyCharm will be importing Python libraries, etc., wait a while, click the [OK] button to highlight it.

画像
'Hello World'を再度実行しても、同じ問題がまだ存在します。ウィンドウシステムにはまだ設定されていないものがあると思いますが、それは不可能だと思います。 Pythonは実際に正常に実行されました。システムの「環境変数」をダウンロードするをチェックします。
[マイコンピュータ]を右クリックし、[プロパティ]を選択し、ポップアップの[システムプロパティ]で[環境変数]を選択し、ポップアップの[環境変数]で[パス]を選択し、[編集]をクリックします。下の図。

画像
Pythonの2つの可変パスがここにとどまっているのを見て、何がうまくいかない可能性がありますか?
あきらめて、このPyCharm構成はとても面倒です。
私はしばらくの間、それについて考え、そうすることを望まなかった。私は戻ってきて、Baiduをもう一度チェックしました。ふふ、一部のネチズンは実際に答えを出しました。
次の図に示すように、Pycharmの右上隅にある[開く…ダイアログ]をクリックします。



画像
ポップアップダイアログボックスで、次に示すように、実行中の「hello.py」ファイルを「スクリプトパス」オプションの最後に追加します。
スクリプトパス
[OK]をクリックして実行します、ハハ、問題は最終的に解決されました。
長い間投げてきましたが、ようやく問題は解決し、たくさんのことを学びました。この種の問題は、Pythonの初心者が遭遇する可能性があると思います。この記事が問題の解決策を提供し、迂回を回避できることを願っています。