user2580401 user2580401 - 7 days ago 8
Python Question

Python - PYTHONPATH in linux

I'm novice in this, and I have started learning python, but I have some questions that I should not be able to understand,


  1. What is exactly the PYTHONPATH (in ubuntu)? is a folder?

  2. Is python presented by default in ubuntu or it should be installed?

  3. Where is the folder in which all modules are (I have a lot folders called python_)?

  4. If I wish a new module to work when I'm programming (such as pyopengl) where should I going to introduce all the folders I've got in the folder downloaded?

  5. Coming back from the PYTHONPATH issue, How do I configure the PYTHONPATH in order to get working my new module? thanks.


Answer
  1. PYTHONPATH is an environment variable
  2. Yes (see http://unix.stackexchange.com/questions/24802/on-which-unix-distributions-is-python-installed-as-part-of-the-default-install)
  3. /usr/lib/python2.7 on Ubuntu
  4. you shouldn't install packages manually. Instead, use pip. When a package isn't in pip, it usually has a setuptools setup script which will install the package into the proper location (see point 3).
  5. if you use pip or setuptools, then you don't need to set PYTHONPATH explicitly

If you look at the instructions for pyopengl, you'll see that they are consistent with points 4 and 5.

Comments