VSCode doesn't recognize python interpreter - python-3.x

I am on arch linux, and for some reason VSCode doesn't find the python interpreter.
I have tried to set the python interpreter path to to be right (/bin/python3), and if I actually run a file then it works, but the python extension says I need to download python before using the extension and the auto complete doesnt work. Any Ideas? Any ways to debug this issue?

I'm having a similar issues, downgrading to Electron9.3.3-1 solved the issue for me while waiting for a potential fix.
Source: GitHub Issue

I found my solution with vscode-insiders. The current vscode python extension is already move on to rely on jupyter, another extension available only on vscode insiders.
Plus the vsc insiders logo looks cool..

Related

VSCode terminal is using the wrong python version

I have a new mac with python 3 installed from homebrew and visual studio code. I am not a python person by default I tend to use java but wanted to try a project for fun.
Just my terminal in VSCode has a system install of python 3.8 version that I am not using I want to use my brew install version as shown in screen shots. if I do echo $path it shows correct, my mac terminal shows correct and my VSCode python plugin has the correct version showing. I have rebooted several times in case it was cached.
I want to use the brew version 3.9.7. My project is failing to load imports such as "import requests" I assume because of this. The import fail error is.
Import "requests" could not be resolved from sourcePylancereportMissingModuleSource
I have installed and uninstalled requests many times always through VSCode command line.
Perhaps the values in $PATH of VS Code is in a different order than that of Terminal.app.
See https://github.com/microsoft/vscode/issues/70248 for more informations.
You can simply set "terminal.integrated.inheritEnv": false. This works well for me.
Try putting the following in settings.json:
"terminal.integrated.env.osx": {
"PATH": ""
}
Save the file, close any terminal window and restart VS Code.
You can read more here.
Go into VS Code settings: Code->Preferences->Settings. Type the following in the search box:
terminal.integrated.inheritEnv": false
Uncheck the option box beside the setting "whether new shells should inherit their environment from VS Code..." to set it to False.
Restart VS code and try again, you should have the same version of python as on your standard terminal.

Issue using Black formatter in PyCharm

I am trying to setup the formatter "black" to work with PyCharm. I have tried setting it up with both the standard External Tools preferences and using the Files Watcher Plugin. Neither has worked for me.
I am getting these errors:
I have it installed in /Users/Scott/Library/Python/3.8/lib/python/site-packages/black.py and want it to run globally for all Python project files when I save.
This is how my preferences look:
I am new to Python and PyCharm and Stack Overflow for that matter, and am stilling setting this up. I appreciate your help.
Your problem is that you use .py file as a command. You need to add python to tell which program can execute this code.
Alternatively, you can use black executable if it is installed in your python environment.

How to reconfigure VSCode for python

I had configured VSCode for python, it was working fine, linter , autopep all the things were working fine. After some days I installed Anaconda, from here problems started, after this I got error that Select Python Interpreter at the bottom of VSCode, I added python path to the settings,then it works fine but "Select Python Interpreter" error was still coming. Some days before I installed Javascript extension, after this linter,autopep nothing is working,only using python command line python program is getting run.
I removed javascript extension,again installed VSCode, now the things are worst,nothing is working now.Please anyone help me to how to reconfigure VSCode to work properly.Even I removed Anaconda installation too, still problems not solved. I searched online but did not get any proper inforamtion.
I had a similar issue, I think you have both Python 3.7 and Anaconda installed separately, Use any one them , remove the other. When both of them is together it was throwing lot of issues. I would prefer to remove Anaconda(pure personal choice).If you don't have much customized settings in VScode, delete its user configuration files and set it up again. it will work

How to chose which 3.x python version on cmd?

I have some code working with python 3.6.6 but I have 3.7.2 in enviroment too.When I try to run my code in cmd, it's trying to run with 3.7.2.How can I chance it?
There are a couple of ways you can tell a script to run with a specific version of Python, commonly you'd use a shebang:
#!/user/bin/env/python3.x
However, I think this only works for Linux/Mac which it sounds like you aren't on if you're referring to cmd. You may want to check out this answer which has a few other options that may help: How do I tell a Python script to use a particular version
Alternatively you can set up a virtual environment, which allows you to run different versions of Python, modules and any other environment settings for a specific project. If that sounds like a better solution then this answer should help you out: (Easiest) Way to use Python 3.6 and 3.7 on same computer?

cx_Freeze not found error-python

Ok, I am using python 3.4.3 and I think I downloaded the right file but when I go to python shell, it says No module named 'cx_Freeze'
I know there are plenty of questions like this but none of them helped. There was one I found using my exact same problem and version but even that did not work. I do not know what to do. I have put the file in the same place, I think anyways, as python is and I tried putting it on my desktop but still does not work. Any ideas?
faced a similar problem (Python 3.4 32-bit, on Windows 7 64-bit). After installation of cx_freeze, three files appeared in c:\Python34\Scripts:
cxfreeze
cxfreeze-postinstall
cxfreeze-quickstart
These files have no file extensions, but appear to be Python scripts. When you run python.exe cxfreeze-postinstall from the command prompt, two batch files are being created in the Python scripts directory:
cxfreeze.bat
cxfreeze-quickstart.bat
From that moment on, you should be able to run cx_freeze.
cx_freeze was installed using the provided win32 installer (cx_Freeze-4.3.3.win32-py3.4.exe). Installing it using pip gave exactly the same result.
Ok, I figured it out. So this is for all the future people have the same problem as I am. First, download pip. Then open a python shell and import pip. This is to make sure the download of pip was successful. Then go to the cx_Freeze website and for python 3.4.3, it will be the last one I think. It will say the version of cx_Freeze and then say the version of python which is 3.4.3 for me. That will download and then go to python shell and import cx_Freeze. It should work. Remember that you have to capitalize the "F" and have the code be exactly like this "cx_Freeze" but without the quotes. That is how I solved this problem with this exact python version.

Resources