VScode environment construction (Windows10, Python, C ++, C, Git)

Overview

This article

――I got a new PC and built the environment again, so a memorandum --I hope it will be a hint for those who handle Python, C ++, C, etc. in VScode.

I wrote it with that feeling.

If you read this article

--You can use VScode! --You can use Python! --C ++ and C can be used!

The content is like that, specifically

--Installing VScode --Installing Anaconda --Python virtual environment settings, etc. --Installing a compiler to run C ++, C --Installation of various extensions --My VScode settings

It is like that. …… But in reality, most of them are article introductions, so I am grateful to the pioneers.

VScode installation

So, let's install VScode first. VScode is the one who writes the code (miscellaneous).

VScode installation procedure @ Windows10

...... It goes on even like this.

Python environment construction

Next is the construction of the Python environment. Python is getting a lot of attention now, and it's a language that is often used for machine learning.

First, add Anaconda. Is it a snake binding? Anaconda is all in one! It's like this, and Jupyter lab is very convenient, so I won't introduce it this time, but please try it.

Python environment construction (Anaconda + VSCode) @ Windows10 [January 2020 version]

Just a little about the virtual environment. There are various versions of Python such as 3.7 and 3.8, and there are many useful libraries (images that do not look like toolboxes), so there are quite a few cases where I want to change the settings for each project. Therefore, we create a virtual environment and manage versions etc. in it. At the first "study alone" stage, you don't have to be so conscious of the virtual environment, but I think it would be nice if you could use it.

So, in the above article, I gave a little more detail about that area. You can build a virtual environment on Anaconda's GUI (that is, even if it is not a command button).

Creating a virtual environment in Anaconda is done using the command `conda`, but the following are the basic commands other than those in the above URL.

Build / Delete Virtual Environment with Anaconda

C ++, C environment construction

Here, we will introduce two methods. Actually, I did the first half method and some of it didn't work, so I did the second half method ... so maybe the second half method is better for the first time.

Let's start with the first article.

Building a competitive professional environment with Visual Studio Code (Introduction)

It's an article with a lot of likes, so I think it's my fault that I failed. Later, I will talk about the part that failed.

This method is to put an OS called "Ubuntu" on top of an OS called Windows and compile (make it executable) C or C ++ in it. According to the above article, the one introduced in the second one seems to have a strange bug, so is it better to use the above method? It was the impression that.

Now, let me introduce the second article.

Until building and debugging C ++ code with VSCode + MinGW-64

This method is to install and use MinGW, a "C ++ compiler that can be used for free on Windows" (quoted).

I ended up doing both of the above, but maybe because of that situation, or because I made it possible to use Python, there were some addictive parts, so the next section is about the points where it fits. I'm going to talk.

VScode x Python x C ++

Multiple shells

This is easy to understand about what is a shell.

What is a shell

I can open a terminal with VScode and check the shells that can be used in "Select default shell", but if you have done everything up to this point

--Command Prompt (Can run Python) --Windows PowerShell (default) --WSL Bash (Can use C, C ++, etc. and Unix commands)

I think that you can select from three. For example, WSL Bash can't run Python (probably), so at first you might get confused with "Oh, I set it up but I can't use Python!". Rest assured that you can use it without problems if you switch the shell for each language.

I can't use convenient C and C ++ extensions! ??

Yes, this is where I stumbled in the first half of the previous two articles. Specifically, I encountered such an event.

Try to prepare C / C ++ development environment with VSCode

I installed "C / C ++", which is a convenient extension that points out code mistakes, which is explained in 2-3 of the second article.

#include <stdio.h>

I got an error like "include path is incorrect!" In the include statement such as. Well, I won't go into details, but I couldn't solve this problem on my own, so I changed to the second method ...

Install Git

This is about my stumbling block, but let's take a second look and install Git. Git is the one who manages and shares code. Convenient.

Procedure to install git on Windows

Also, there are various inconveniences just by installing it, so I think it is better to make initial settings as well. This will be helpful.

Summary of basic operations of Git in VS Code

I think that the name and email address are enough for the "Initial setting of Git" part. By doing this, you will be able to perform various operations on the VScode GUI.

By the way, if you install Git, the number of shells will increase again and you will be able to use "Git Bash" this time. "Initial setting of Git" is done on this Git Bash, but the setting contents here are ** not reflected in other shells ** in some cases. The GUI reflects the settings made in Git Bash, but be careful when operating Git using other shells.

I think this story is sloppy for first-time users, but if you stumble on the settings, the following article may be helpful.

Check / change Git settings with git config

As for Git commands, I wrote a little summary before, so I'll add it. (Blatant promotion)

Git cheat sheet

If you haven't used Git yet, please take a look, as you can learn about Git by looking at the reference URL in the above article.

Various extensions

So from here on, it's about extensions and VScode settings. That said, I'm sorry for the basics ...

The method of adding the extension function was described in the above environment settings, so I will omit it (I will omit it).

C/C++ I introduced this a little at my stumbling block. It's very convenient because it points out mistakes in the code written in C / C ++.

Code Spell Checker For example, if you write "haloo", it will warn you "Hey, isn't there such English?" A single typo can stop the program from working, which is quite useful.

Git History It displays Git logs etc. in a very easy-to-read manner.

Japanese Language Pack for Visual Studio Code It makes VS code Japanese.

Python This is an indispensable extension if you use Python. It will find mistakes in the code and will do various things.

Pylance It does things that you can't reach with the above Python. For details, please see the following article.

[Python] I immediately tried using Pylance's VS Code extension.

zenkaku It discovers the programmer's enemy, full-width. It doesn't move because of full-width characters ... I feel like everyone goes through it once.

Various VScode settings

Finally, I would like to introduce the settings I have made.

Editor: Insert Spaces I try to insert a Tab when I press Tab (default is 4 spaces). It's a matter of taste.

Editor: Render Whitespace Whitespace characters will be displayed. I am boundary. With this, you can see if it is a tab, and if there are no spaces in strange places.

Editor: Word Wrap You can set whether to wrap and display the horizontally long code. I'm on. It's a matter of taste.

Files: Auto Save You can set whether to auto save. I have an after delay. Of course, the advantage of auto save is a countermeasure when you forget to save or the PC suddenly goes down, but you must keep in mind that you may not be able to undo editing as a disadvantage. This is also a matter of taste.

Files: Eol You can change the default newline character. Actually, the line feed character may differ depending on the environment, but I'm afraid of that, so I set it to \ n.

Finally

So, it's just a memorandum, but I hope it helps someone. Also, I would be grateful if you could tell me if there is a better way (especially about my stumbling block).

Recommended Posts

VScode environment construction (Windows10, Python, C ++, C, Git)
python windows environment construction
Python environment construction (Anaconda + VSCode) @ Windows10 [January 2020 version]
Python environment construction (Windows10 + Emacs)
Python environment construction under Windows7 environment
Python environment construction memo on Windows 10
Anaconda python environment construction on Windows 10
Python environment construction
Environment construction (python)
python environment construction
Python --Environment construction
Python environment construction
python environment construction
Python project environment construction procedure (for windows)
Python3 + venv + VSCode + macOS development environment construction
Python garbled in Windows + Git Bash environment
Windows + gVim + Poetry python development environment construction
Python development environment construction
python2.7 development environment construction
Mac environment construction Python
Python environment construction @ Win7
Python + Anaconda + Pycharm environment construction
PyTorch C ++ (LibTorch) environment construction
CI environment construction ~ Python edition ~
Python environment construction For Mac
Anaconda3 python environment construction procedure
Build Python environment on Windows
Python environment construction and TensorFlow
Build python environment on windows
QGIS3 Python plugin development environment construction with VSCode (macOS)
[MEMO] [Development environment construction] Python
[Tensorflow] Tensorflow environment construction on Windows 10
Environment construction of python2 & 3 (OSX)
OpenJTalk on Windows10 (Speak Japanese with Python from environment construction)
Python environment construction procedure memo using Docker on Windows10 Home
VScode environment construction (on Mac) & graph display in Python (@browser)
Get started with Python! ~ ① Environment construction ~
Python + Unity Reinforcement learning environment construction
Install python2.7 on windows 32bit environment
I checked Mac Python environment construction
Python development environment construction on macOS
Python environment construction (pyenv + poetry + pipx)
Git & Github & python & VScode Personal memorandum
Ml-Agents Release 6 (0.19.0) Environment Construction Summary [Windows]
Environment construction of python3.8 on mac
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Install Python development environment on Windows 10
Python3 TensorFlow for Mac environment construction
Emacs Python development environment construction memo
pytorch @ python3.8 environment construction with pipenv
[docker] python3.5 + numpy + matplotlib environment construction
Python3.6 environment construction (using Win environment Anaconda)
OpenCV3 & Python3 environment construction on Ubuntu
Create a Python execution environment for Windows with VScode + Remote WSL
Example of building python development environment on windows (wsl2, vscode, pipenv)
Create a C ++ and Python execution environment with WSL2 + Docker + VSCode
LaTeX and R (a little Python) environment construction with SublimeText3 (Windows)
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Python (anaconda) development environment construction procedure (SpringToolsSuites) _2020.4
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Where VSCode + venv environment construction got stuck