Where is the Python Interpreter?
I'm trying to follow some easy tutorials for python and i can't seem to find the "python interpreter".
I'm using: Python 2.3.4 (#1, Oct 26 2004, 16:42:40) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 I made a file called "brian": Code:
#!/usr/bin when i try to run it i get this: Code:
$ brian #!/usr/local/bin/python #!/usr/bin #!/usr/lib #!/ #!/usr/local/bin #!/usr/lib/python2.3 #!/usr/lib/ooo-1.1/program all of these yield me the same error. Any help on this would be greatly appreciated. Thanks... |
try "#!/usr/bin/python"
if you want to run 'brian', you need to use "./brian" because it is not in your $PATH. Or you can use a full pathname ie "/home/brian/code/brian" |
i still get the same error. am i trying to call the file wrong? the tutorial says i only have to type the filename to get it to execute.
|
OK, run "which python", use the path it gives you with the "#!" added first.
Now where is this 'brian' you are trying to run? If it is not in your path then you need to use "./" |
Alright i'm confused....
Code:
$ which python 'brian' is saved in /home/chomper and that's where i am at when i try to run 'brian' . i tried ./brian and it worked. i don't understand that. how am i not in the directory where it's saved when i obviously am? what's my problem? i made another brian in another directory and it's the same thing. it doesn't work without the ./ first. please explain... |
Ok, unless a script or program is in your $PATH variable, you need to call the program explicitly. $PATH is just a list of directories that bash looks for programs in. Your home directory is typically not in the PATH, so you need to tell bash where the script is using either:
Code:
$ /home/chomper/brian |
Ah-ha...i see. Well thanks a bunch helping me jump my first python hurdle and teaching me some too.
Out of curiosity, how would i alter this $PATH thing you speak of so i could point it to a directory containing commands i want bash to recognize? This will be for my future reference, once i code something cool. Thanks again! |
Quote:
Code:
$ export PATH=$PATH:/some/new/directory |
cool. Thanks alot!
|
All times are GMT -5. The time now is 06:21 AM. |