sys.path() and PYTHONPATH issues

后端 未结 3 1406
长情又很酷
长情又很酷 2021-01-05 22:05

I\'ve been learning Python, I\'m working in 2.7.3, and I\'m trying to understand import statements.

  1. The documentation says that when you attemp

3条回答
  •  北海茫月
    2021-01-05 22:40

    PYTHONPATH is not defined on your system. That means all you see in sys.path except for '' is "the installation-dependent default."

    Environment variables characterize the environment, not a process. However, you can tweak them when starting a process by using, say, Linux env command. That basically means that the process will run in a different environment. The "how if works" part of your question can have platform-dependent answers. However, I don't think you can "tell where a persistent environment variable is stored", if you mean a file. Environment variables can be set in any of the files that are executed at some point (usually at startup) or just in the command line.

提交回复
热议问题