5

Referring to the question here, I would like to know where is the PYTHONPATH defined in the very first place. Instead of adding a directory permanently to PYTHONPATH by defining it in a bashrc (local or global), or through any other way, I feel it would be better if it is added in the default source itself.

Community
  • 1
  • 1
Gautam Somani
  • 456
  • 1
  • 4
  • 18

1 Answers1

3

That is not a good idea: you'd have to modify python's built-in code and libraries. I do not even know if they are compiled but if they weren't, even though you'd be able to modify the code (which I do not know if that is possible in the simple way we assume it) you would run into trouble:

  1. You may screw up any other part of the code by which python won't ever run and you won't ever know why
  2. Your application wouldn't be compatible with any other computer since you'd have to modify the package too.
  3. Even though you had a script modifying the package (so it is compatible) or even if you just ran it in a unique machine, you may not have enough system permissions to do so (in your case I suppose you do since I assume you are the machine's owner, but you may not)
  4. Most Python implementations do not have the raw source code available on-site. It's all compiled. So, you would need to go download the raw code and compile yourself, which is yet another problem.

I do not really recommend it, but if you still want to try, I hope someone may answer your question better than me.

  • 2
    Most Python implementations do not have the raw source code available on-site. It's all compiled. So, you would need to go download the raw code and compile yourself, which is yet another problem. +1 for giving a *sane* answer instead of *the* answer. :) –  Dec 26 '14 at 17:05
  • @iCodez thank you very much. I will improve my answer and add your point too. –  Dec 26 '14 at 17:06
  • 1
    @iCodez If recompiling is the only way, then yes, that will be the biggest roadblock. – Gautam Somani Dec 26 '14 at 17:15