Every line of 'python current path' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
6 def _add_to_python_path(p): 7 if p not in sys.path: sys.path.append(p)
23 @property 24 def python(self): 25 return self.get_binary('python')
87 @property 88 def python_path(self): 89 binary = 'python' 90 if sys.platform in ('win32', 'cygwin'): 91 binary += '.exe' 92 93 return os.path.join(self.bin_path, binary)
57 def get_path(self): 58 path = self.path 59 if self.envvar and self.envvar in os.environ: 60 env_path = os.environ[self.envvar].split(':') 61 path = env_path + path 62 63 return [os.getcwd()] + path
10 def get_python3_path(): 11 # If it is not working, Please replace python3_path with your local python3 path. shell: which python3 12 if (platform.system() == "Darwin"): 13 # which python3 14 path = "/usr/local/bin/python3" 15 if platform.system() == "Windows": 16 path = "python" 17 if platform.system() == "Linux": 18 path = "/usr/bin/python3" 19 return path
14 def is_python(path): 15 '''Whether the given file is Python.''' 16 if path is not None: 17 return run(['file', path]).find('Python') >= 0 18 else: 19 return False
30 def get_program_path(): 31 if hasattr(sys, 'frozen'): 32 path = sys.executable 33 else: 34 path = __file__ 35 36 return str(os.path.dirname(os.path.realpath(unicode(path, sys.getfilesystemencoding()))))
20 def get_path(): 21 env = os.environ.get("_PYNSOT_PYTHONPATH") 22 if env: 23 return env.split(":") 24 return sys.path
143 def get_path(): 144 if getattr(sys, 'frozen', False): 145 return os.path.dirname(sys.executable) 146 else: 147 return os.path.abspath(os.path.dirname(sys.argv[0]))
30 def get_python_executable() -> str: 31 ''' 32 Gets the absolute path of the executable binary for the Python interpreter. 33 ''' 34 if not sys.executable: 35 raise RuntimeError('Unable to get the path to the Python executable.') 36 return sys.executable