Skip to content

Commit d5a0ee7

Browse files
committed
fix #569
1 parent c1149c0 commit d5a0ee7

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/client/providers/setInterpreterProvider.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as vscode from "vscode";
66
import * as settings from "./../common/configSettings";
77
import * as utils from "../common/utils";
88
import { createDeferred } from '../common/helpers';
9+
import * as untildify from 'untildify';
910

1011
// where to find the Python binary within a conda env
1112
const 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

Comments
 (0)