Experts Exchange connects you with the people and services you need so you can get back to work.
import os, sys
# determine on which OS you're running
running_on_windows = sys.platform == 'win32'
quote_character = '"'
separator = ';'
quote_character = ''
separator = ':'
if not 'PYTHONPATH' in os.environ:
# it seems PYTHONPATH was empty. so just set it
os.environ['PYTHONPATH'] = path_name
quoted_path = quote_character + path_name + quote_character
new_pythonpath = quoted_path + separator + os.environ['PYTHONPATH']
os.environ['PYTHONPATH'] = new_pythonpath
Open in new window
This course will introduce you to C++ 11 and teach you about syntax fundamentals.
setenv PYTHONPATH = $PYTHONPATH:/your/own/path
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', 'C:\\Windows\\system32\\python27.zip', 'c:\\Python27\\DLLs', 'c:\\Python27\\lib', 'c:\\Python27\\lib\\plat-win', 'c:\\Python27\\lib\\lib-tk', 'c:\\Python27', 'c:\\Python27\\lib\\site-packages']
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.