1

Good day everyone,

I have Python but I have no idea how to get it set up. sure its installed and all that and I can run it via the program or the terminal, but the first step according to the tutorial is to set the PATH in the "chs shell". look I'm fairly new to Linux and programming so at the moment this is greek to me. the very next step speaks about the bash... now everything I search online seems to expect the reader to know what those directories (if I can call them that) are and where/how you can call them up. please advise!

4
  • 4
    "according to the tutorial" what tutorial? what exactly are you trying to do? In most cases, the version of python that is installed on Ubuntu does not need any additional setup. – steeldriver Dec 13 '16 at 16:14
  • 2
    There's almost never a reason to change the PATH variable. When using the preinstalled Python or installing Python with Apt, Python works just fine without changing that. – Chai T. Rex Dec 13 '16 at 16:16
  • 2
    Is there any problematic behavior that stops you from using Python? Otherwise just use it :) – M. Becerra Dec 13 '16 at 16:24
  • Python is an interpreter to run python code. How do you have in mind to use it? No doubt you are using it already, since many applications, or sections of them, are written in python. – Jacob Vlijm Dec 13 '16 at 16:58
3

I assume you use Ubuntu, which comes with both Python 2.7 and Python 3.5 preinstalled.

You need to distinguish between the Python GUI and Python that you can run within a bash session, aka. the black terminal window that you can start by holding down CTRL + ALT and pressing `T

Inside the bash, you simply type python (for version 2.7) or python3 (for version 3.5) and this will output something like this:

python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

You can now write code following the 3 ">>>". For example, try to write print "hello world" (for 2.7) or print("hello world") (for 3.5) and it will output hello world. To leave python, just type exit() or close the terminal window.

You don't need to set any path, everything should work out of the box unless you made changes already. You can create folders with the mkdir command in the terminal and save your Python programs in there.

The path for Ubuntu/linux is not something you at this point need to give much thought. You should focus on understanding the basics in Python. Write simple and small programs, and store them in a folder.

If you are "lost" inside the terminal, and you need to find your Desktop for example, where you can create folders, in which you can store your .py files, you can do the following.

  • cd /home/
  • ls
  • cd folder-name-shown-after-typing-ls (this is the name of the folder of your laptop name most likely)
  • cd Desktop

You are now in a familiar place, as the Desktop is what you see when you first open Ubuntu.

Hope this will get you started on finding your way. It seems foreign at first, but it is actually very easy once you dig a bit more into it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.