Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:35:57+00:00 2026-06-15T17:35:57+00:00

I understand that sys.path refers to OS paths that have your system libraries. I

  • 0

I understand that sys.path refers to

  1. OS paths that have your system libraries. I take it that these refer to /lib in *nix or Windows on Windows.
  2. current directory python started from – I take it if Python is started from C:\Python, this would be the current path
  3. environmental variable $PYTHONPATH or %PYTHONPATH% – This refers to the path where I can call the Python binary from the command line
  4. you can add paths at runtime – Which I understand to be when I run IDLE

I am able to add paths by running the command sys.path.append however when I run the command sys.path.remove to ‘delete’ the path I appended, I am unable to do so. Is there a way to do so without having to close IDLE each time?

I am running Python 2.7 on Windows 7 as well as Ubuntu

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:35:58+00:00Added an answer on June 15, 2026 at 5:35 pm

    Everything works as intended on my machine 🙂

    Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> sys.path.append('/home/sergey')
    >>> sys.path
    ['', ..., '/home/sergey']
    >>> sys.path.remove('/home/sergey')
    >>> sys.path
    ['', ...]
    >>> 
    

    What exactly have you tried?

    Regarding your understanding of things – I’m afraid there are some mis-understandings:

    1. sys.path is a list of directories which contain Python modules, not system libraries. So, simplifying, when you have something like import blah in your script, Python interpreter checks those directories one by one to check if there is a file called blah.py (or a subdirectory named blah with __init__.py file inside)

    2. Current directory is where the script is located, not where Python interpreter is. So if you have foo.py and bar.py in a directory, you can use import bar in foo.py and the module will be found because it’s in the same directory.

    3. $PYTHONPATH is an environment variable which is getting appended to sys.path on interpreter startup. So, again, it is related to module search path and has nothing to do with starting Python from command line.

    4. Correct, you can modify sys.path at runtime – either when running a python script on in IDLE

    See sys.path and site for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that in CUDA's memory hierachy, we have things like shared memory, texture
In the below code I understand that sys.argv uses lists, however I am not
I have a C file that looks like this: #include <stdio.h> #include <sys/types.h> #include
I understand that: '\n' // literally the backslash character followed by the character for
I understand that JVM and CLR were designed as stack-based virtual machines. When JIT
I understand that the em measurement is a relative unit for font-size, relative to
I understand that this question may be subjective, this is why I need an
I understand that applications under the same domain name can talk to each other
I understand that storage history is something that is better to keep for vcs
I understand that we can set the various style attributes from code behind using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.