Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PythonPath file
#1
I am a beginning python programmer. My computer is running Linux Mint 17.3. I am using IDLE as the development environment. My question is simple. I know how to set a Pythonpath temporarily for a session. I want to include one or two directories in the path permanently. I also understand I can do that by appending the directories to the path file because it is a list. My problem is that I cannot find the file and I have searched with a number of extensions. If someone can tell me where I should start to look I would be very grateful.

Thanks.
Reply
#2
PYTHONPATH is an environment variable.  In linux, those are stored in either .bash or .bash_profile or .bashrc in your home directory (/home/your_user_name).  If you're using a file browser, some of them hide files that start with ".", as those are normally "hidden" files.  If you open a console and navigate there ("cd ~"), you can see all files, including hidden ones, with "ls -a".  You can then edit that file using a text editor like nano "nano .bash".

What you add to that file will look similar to the following:

export PYTHONPATH="${PYTHONPATH}:/my/other/path"
Reply
#3
Do you want to programatically add these unknown directories to your path, or do you just want to find and add them on your system?
Reply
#4
Thanks for the replies. I will look for the file as suggested in the first post. As to second response. I would like to know how to add them programatically but my original question was to modify the file on my system so I could store all my scripts/programs in one place that is not defined with the python install. That is my current goal.

Thanks for the quick response.
Reply
#5
OK, I did look through my home directory and looked into all the text files, including hidden ones, and I could not find a file with path contents. Is there a second location where the file may be?
Reply
#6
Yes, but you shouldn't change the system files. That's why the code I posted starts with 'PYTHONPATH="${PYTHONPATH}'... you just add your stuff to whatever the path happens to already be. You don't want to actually change it, because then your computer would start behaving... badly.
Reply
#7
OK, I'll give it a shot. I misunderstood the reason for the command.
Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to set PYTHONPATH in Visual Studio Code? aupres 5 3,774 Aug-15-2023, 03:51 PM
Last Post: snippsat
  the exe file by generated by pyinstaller ,can't get the PYTHONPATH roger2020 11 6,857 Jan-14-2020, 11:07 AM
Last Post: roger2020
  setting pythonpath variable in environment variables saisankalpj 3 3,427 Dec-05-2018, 10:33 PM
Last Post: Gribouillis
  Interpreter does not consider PYTHONPATH environment variable VegetaSSJ5 2 3,979 Aug-04-2017, 07:03 AM
Last Post: VegetaSSJ5

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020