import sys
print sys.path
sys.path+=['D:\\zjm_code']
print sys.path
it can’t be save,how does do it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Where is environment variable
PYTHONPATHdefined in your working environment?In Unix-like systems it would be in a bash script such as
~/.bashrc.In Windows it could be a
.BATor.CMDfile but more often will be in the registry.“Saving” a setting of
PYTHONPATHto a file is easy.Writing to the Windows registry is much harder, alas. Doable, yes, but, if you get it in the least wrong, you’re likely to make your whole machine unusable.
In your
site-packagesdirectory (which should itself be insys.path) you can create a file namedsitecustomize.pythat is automatically imported, if it exists, each time a Python program starts. I suggest that this is simpler and less risky than messing with the registry. So, write yoursys.pathmanipulations to such asitecustomize.pyfile.