I\'m trying to run the autopep8 linter on a Python file in VSCode.
I\'ve followed the instructions here: https://code.visualstudio.com/docs/python/environments and selec
1.Select the File > Preferences > Settings command (⌘,) to open your User Settings.
2.Search and Create or modify an entry for python.pythonPath with the full path to the Python executable according to your requirements.For Example i changed it to python2.6 path to this path /usr/local/bin/python3.
I was having a similar problem with pylint in a docker container. I realized that the reason the VS-Code-prompted pylint install didn't work for me was because I was using the global python installation (global inside my docker container, anyway), which can require elevated permissions to install things and VS code wasn't running as root in the container. According to the vs code python extension docs:
Note: If you're using a global environment and VS Code is not running elevated, linter installation may fail. In that case, either run VS Code elevated, or manually run the Python package manager to install the linter at an elevated command prompt for the same environment: for example sudo pip3 install pylint (macOS/Linux) or pip install pylint (Windows, at an elevated prompt)
I ran into this problem while learning django and the terminal would not let me pip install anything.
Create a virtual environment in shell and then use the path of the environment as your interpreter. This worked for me.
Note: You might want to create to create the environment in a different shell altogether and then upload the folder of the environment into vscode. Then you open up the settings file in the environment folder.
This image will hopefully give you a good idea. Click Here
You can use the pycharm instead of it,ues Pycharm open the same DIR,it will add the .idea DIR in it , then close Pycharm or not,if you like it. you will get that,the question is gone.
I have multiple python versions:
2.7
3.6
3.7
press the following (Show All Commands): Ctrl + Shift + P
paste the following: Python: Select Interpreter
Select one of the version that it shows, I have selected python 3.7.3 64-bit
press Ctrl + ,
to open Settings
search for python.pythonPath
change python
to /usr/bin/python3.7
Note: this may not be needed, however, make sure /usr/bin/python3.7
really exists for you, you may have at a different path like /usr/local/bin/python3.7
, etc.
Run the following command in Terminal: apt-get install python3-pip
With the above steps, all issues got resolved. Hope that helps.
For WSL users:
If you have your work files in linux subsystem path, you still need pip for windows in order to VSCode to use it.