-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The python virtual environment selected don‘t take effect after "select workspace interpreter" in ubuntu #173
Comments
From @appleyuchi on August 30, 2017 13:40 I down load all from |
From @appleyuchi on August 30, 2017 13:42 Also ,I have tried to edit python.Pythonpath and python.venvPath and then reload ,all of them don't take effect,my system is : |
@appleyuchi How are you running the code mentioned in step 4? |
I'm closing this as it has been over a month since we requested more info. If we do get the info at a later date we can re-open this issue. |
Hello, I am having the same issue after updating to 1.20 today. Below is my settings.json. =====
}Please help, thanking you in advance. |
You haven't selected an interpreter, the seeing is missing in settings.json. the seeing is |
I have given up vscode and use sublime now |
@appleyuchi I'm sorry to hear this. |
Accurately speaking,it was not solved in linux(of course I know it's OK in windows)serveral month ago,I don't know whether it's ok now,you can try。 |
May be it's my fault,I do not reading relevant instruction about vscode really carefully。 |
and this is my .bashrc see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)for examplesIf not running interactively, don't do anythingcase $- in don't put duplicate lines or lines starting with space in the history.See bash(1) for more optionsHISTCONTROL=ignoreboth append to the history file, don't overwrite itshopt -s histappend for setting history length see HISTSIZE and HISTFILESIZE in bash(1)HISTSIZE=1000 check the window size after each command and, if necessary,update the values of LINES and COLUMNS.shopt -s checkwinsize If set, the pattern "**" used in a pathname expansion context willmatch all files and zero or more directories and subdirectories.#shopt -s globstar make less more friendly for non-text input files, see lesspipe(1)[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" set variable identifying the chroot you work in (used in the prompt below)if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then set a fancy prompt (non-color, unless we know we "want" color)case "$TERM" in uncomment for a colored prompt, if the terminal has the capability; turnedoff by default to not distract the user: the focus in a terminal windowshould be on the output of commands, not on the prompt#force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ "$color_prompt" = yes ]; then If this is an xterm set the title to user@host:dircase "$TERM" in enable color support of ls and also add handy aliasesif [ -x /usr/bin/dircolors ]; then
fi colored GCC warnings and errors#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' some more ls aliasesalias ll='ls -alF' Add an "alert" alias for long running commands. Use like so:sleep 10; alertalias alert='notify-send --urgency=low -i "$([ Alias definitions.You may want to put all your additions into a separate file like~/.bash_aliases, instead of adding them here directly.See /usr/share/doc/bash-doc/examples in the bash-doc package.if [ -f ~/.bash_aliases ]; then enable programmable completion features (you don't need to enablethis, if it's already enabled in /etc/bash.bashrc and /etc/profilesources /etc/bash.bashrc).if ! shopt -oq posix; then export GTK_IM_MODULE=fcitx ######################################### alias py3.5="source /home/appleyuchi/.virtualenvs/python3.5/bin/activate&&deactivate&&source /home/appleyuchi/.virtualenvs/python3.5/bin/activate" alias py3.6="source /home/appleyuchi/.virtualenvs/python3.6/bin/activate&&deactivate&&source /home/appleyuchi/.virtualenvs/python3.6/bin/activate" py2.7 alias suz="/usr/bin/suz.sh"` |
Please could you provide the contents of the file |
Also please could you ensure you have updated your version of vscode and the python extension to the latest version. (The latest version of python extension is |
You seem to have a custom launch.json config seeing and I'm certain the problem lies there. The value for "pythonPath" in there must be incorrect. |
my launch.json |
I try to change python edtion under ubuntu linux with the yellow arrow marked in the last picture I Uploaded I am from china,It‘s a pity to say that there's no blog listed by Baidu (a search engine like Google) about how to change interpreter of python between python2.x and python3.x under ubuntu linux , |
even if I remove“py2.7”in my .bashrc and save I start like this(not in virtualenv ): |
This is the problem in launch.json, you have hard-nosed the path to python iciest in there: There are two solutions:
Once again the problem is you have changed the python path in launch.json to point to python 2.7, so no matter what you select, when debugging a different value is used. |
It really take effect ,I'm sorry I didn't understand these parameters in deep. |
I have written the whole solution in a Chinese Blog: Many thanks Again~! |
Glad I could help. Please don't hesitate to raise issues of things don't work or seem confusing. |
From @appleyuchi on August 30, 2017 13:38
Environment data
VS Code version: 1.15.1
Python Extension version: 0.7.0
Python Version: 3.5.2
OS and version: Ubuntu16.04
Actual behavior
Python virtual environment did not take effect after select workspace interpreter
Expected behavior
python 3.5
Steps to reproduce:
1、launch from terminal:code
2、ctrl+shift+p=>select workspace interpreter,and choose“/home/appleyuchi/.virtualenvs/python2.7/bin/python”
3、reload
4、run the following code:
import sys
print(sys.prefix)
print(sys.executable)
5、the result is:
[Running] python "/home/appleyuchi/PycharmProjects/csdn_blog_codes/hello.py"
/usr
/usr/bin/python
Logs
Output from
Python
output panel :[Running] python "/home/appleyuchi/PycharmProjects/csdn_blog_codes/hello.py"
/usr
/usr/bin/python
Output from
Console window
(Help->Developer Tools menu)Copied from original issue: DonJayamanne/pythonVSCode#1186
The text was updated successfully, but these errors were encountered: