@@ -6,6 +6,7 @@ import * as vscode from "vscode";
66import * as settings from "./../common/configSettings" ;
77import * as utils from "../common/utils" ;
88import { createDeferred } from '../common/helpers' ;
9+ import * as untildify from 'untildify' ;
910
1011// where to find the Python binary within a conda env
1112const CONDA_RELATIVE_PY_PATH = utils . IS_WINDOWS ? [ 'python' ] : [ 'bin' , 'python' ] ;
@@ -67,7 +68,11 @@ function getSearchPaths(): Promise<string[]> {
6768 return validPathsCollection . reduce ( ( previousValue , currentValue ) => previousValue . concat ( currentValue ) , [ ] ) ;
6869 } ) ;
6970 } else {
70- const paths = [ '/usr/local/bin' , '/usr/bin' , '/bin' , '/usr/sbin' , '/sbin' , '/usr/local/sbin' , '/Envs' , '/.virtualenvs' , '/.pyenv' ] ;
71+ let paths = [ '/usr/local/bin' , '/usr/bin' , '/bin' , '/usr/sbin' , '/sbin' , '/usr/local/sbin' , '/Envs' , '/.virtualenvs' , '/.pyenv' ,
72+ '/.pyenv/versions' ] ;
73+ paths . forEach ( p => {
74+ paths . concat ( untildify ( '~' + p ) ) ;
75+ } ) ;
7176 // Add support for paths such as /Users/xxx/anaconda/bin
7277 if ( process . env [ 'HOME' ] ) {
7378 paths . push ( path . join ( process . env [ 'HOME' ] , 'anaconda' , 'bin' ) ) ;
@@ -116,8 +121,8 @@ function lookForInterpretersInVirtualEnvs(pathToCheck: string): Promise<PythonPa
116121 interpreters . map ( interpreter => {
117122 let venvName = path . basename ( path . dirname ( path . dirname ( interpreter ) ) )
118123 envsInterpreters . push ( {
119- label : `${ venvName } - ${ path . basename ( interpreter ) } ` ,
120- path : interpreter ,
124+ label : `${ venvName } - ${ path . basename ( interpreter ) } ` ,
125+ path : interpreter ,
121126 type : ''
122127 } ) ;
123128 } ) ;
@@ -201,7 +206,7 @@ function suggestPythonPaths(): Promise<PythonPathQuickPickItem[]> {
201206 const condaSuggestions = suggestionsFromConda ( ) ;
202207 const knownPathSuggestions = suggestionsFromKnownPaths ( ) ;
203208 const workspaceVirtualEnvSuggestions = lookForInterpretersInVirtualEnvs ( vscode . workspace . rootPath ) ;
204-
209+
205210 const suggestionPromises = [ condaSuggestions , knownPathSuggestions , workspaceVirtualEnvSuggestions ] ;
206211
207212 if ( settings . PythonSettings . getInstance ( ) . venvPath ) {
0 commit comments