私はPythonには比較的新しく、私の会社ではすでに自動化フレームワークを開発しています。インタプリタ経由でPythonスクリプトを実行しようとすると、なぜ "ImportError:No module named"が表示されますか?
開発プロセスで初めて、いくつかのテストを同時に実行する必要があるという状況に陥りました。この時点まで、私はフレームワークを開発するだけでなく、テストを実行するためにEclipseを常に使用しました(もちろん、一度に1つだけです)。 CMD画面 "python"を使って私のテスト(私がEclipseを使って実行したもの)を実行しようとしたとき、実行されていなかったので、 "ImportError:No module named"私が開発したパッケージから行う輸入に)
Pythonインタプリタはできなかったが、EclipseはすべてのMy Importsと一緒になり、テストを実行する方法は?
インタープリタを使用してテストを実行するにはどうすればよいですか?
編集が
次は私が私の独自のモジュール
C:\Users\alpha_2.PL\workspace\PacketLight Automation\Test_Cases>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900
64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or
"license" for more information.
>>> from Utilities.Browser_Utils import Open_Browser Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError:
No module named 'Utilities'
>>> quit()
C:\Users\alpha_2.PL\workspace\PacketLight Automation\Test_Cases>cd..
C:\Users\alpha_2.PL\workspace\PacketLight Automation>cd Utilities
C:\Users\alpha_2.PL\workspace\PacketLight Automation\Utilities>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900
64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or
"license" for more information.
>>> from Utilities.Browser_Utils import Open_Browser Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError:
No module named 'Utilities'
>>> quit()
C:\Users\alpha_2.PL\workspace\PacketLight Automation\Utilities>dir
Volume in drive C has no label. Volume Serial Number is 1E0C-6554
Directory of C:\Users\alpha_2.PL\workspace\PacketLight Automation\Utilities
08/07/2017 03:05 PM <DIR> .
08/07/2017 03:05 PM <DIR> ..
08/10/2017 10:28 AM 455 Browser_Utils.py
09/05/2017 05:00 PM 7,007 General_Utils.py
07/31/2017 01:49 PM 0 __init__.py
09/05/2017 06:07 PM <DIR> __pycache__
3 File(s) 7,462 bytes
3 Dir(s) 394,707,480,576 bytes free
C:\Users\alpha_2.PL\workspace\PacketLight Automation\Utilities>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900
64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or
"license" for more information.
>>> from Utilities.Browser_Utils import Open_Browser
Traceback (most recent call last):
File "<stdin>", line 1, in <module> ImportError:
No module named 'Utilities'
>>>
利用のpython3の代わりに、あなたのコマンドでのpythonに関するいかなる方向性を持っていなかったあなたなしで答えたすべての人々のための
感謝。そうでなければ、pip3を使ってpython3パッケージをすべてインストールする必要があります。 –
Python環境について少し読んでみる必要があるようです。IDEで言語を使うことを学んだ人にはめったにありません。 EclipseはPYTHONPATH環境変数を管理するために特別な努力をしていることがわかります。 – holdenweb
@rabbit_mq python3とは何ですか?なぜ私の問題を解決できると思いますか? –