Reputation: 2099
I have a very basic question: If we want to run a script called script.py, we go to shell and type "python script.py". However, if we want to check, for example, if Django is installed or not, we first go into Python interpreter by typing "python" in the shell, and while we get the >>> then we type import Django. What is the conceptual difference? For example, in the second case, why directly running "python import Django" in the shell does not work?
Upvotes: 1
Views: 1177
Reputation: 35
python
launch interpreter. You can easly test script on it, and after create a file *.py that you can use on CRON (for ex)
When you type python
and import Django
it do
If an error raise, it seems than Django wasn't installed on computer
Upvotes: 0
Reputation: 532093
python import Django
tries to run a Python script named import
with an argument Django
.
python -c 'import Django'
would attempt to execute the Python statement import Django
as if you had typed it from the Python interpreter directly.
Upvotes: 2