SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

[Is VS Code becoming an AI editor!?] How to set up a Python development environment starting with Anaconda

With the big summer event over, I'm keeping the momentum going and trying to take on a new project.
First, I found I needed to do some web scraping for research. That led me to the idea of building a dedicated 24/7 machine, and I've been proceeding while consulting with ChatGPT.
To start programming with Python and BeautifulSoup (bs4), I first needed to set up a development environment.


1. Why install Anaconda?

  • Reason 1: Scientific libraries are included from the start
    → Essential libraries like numpy, pandas, and matplotlib are ready with one click

  • Reason 2: Virtual environments are easy to create
    → You can separate library versions for each project

  • Reason 3: Beginner-friendly
    → You can easily manage environments from the GUI "Navigator" or the dedicated prompt

Ultimately, Anaconda is very convenient as a "first step."


2. What are all these "various prompts" that appear after installing Anaconda?

If you look at the Windows Start menu after installation, you'll likely be confused by the number of options.

  • Anaconda Prompt → Command line dedicated to Anaconda (use this by default)

  • CMD.exe Prompt → Standard command prompt. You need to run 'conda activate' yourself

  • PowerShell Prompt → High-performance standard Windows shell

  • Anaconda PowerShell Prompt → PowerShell with Anaconda settings integrated

👉 If you're unsure, just use the "Anaconda Prompt".


3. The fact that VS Code is no longer included by default

In the past, installing Anaconda would automatically install VS Code as well, but now it requires a separate installation.
When you go to the official website (https://code.visualstudio.com/),

The open source AI code editor

You might be confused by this unfamiliar tagline, but this is the same old VS Code itself.
You can safely click "Download".


4. Checkpoints when installing VS Code

It is convenient to select this option during installation:

  • ✅ "Add to PATH"

  • ✅ "Add to right-click menu"

With this, you can use it from the Anaconda Prompt as follows:

code .

(Open the current directory in VS Code)

Also, the steps for localizing to Japanese

The easiest way

Launch VS Code

  1. Open the Extensions view on the left (square icon)

    • Shortcut:Win/Linux: Ctrl+Shift+X, Mac: Cmd+Shift+X

  2. Type "Japanese Language Pack" in the search bar

  3. Japanese Language Pack for Visual Studio Code (by Microsoft) and Install

  4. When "Would you like to change the language to Japanese?" appears in the bottom right, press "Restart"

    • If it does not appear, use the Command Palette (Ctrl/Cmd+Shift+P) → "Configure Display Language" → select ja and restart

One-line command (optional)

  • From the terminal:

    1. code --install-extension MS-CEINTL.vscode-language-pack-ja

Checklist if it doesn't work

  • Check if the extension is enabled

  • Command Palette → Display Language Check if ja is selected

  • Remote/WSL/Containers When using: Install the same extension on the remote side (re-install in the remote window)

When you want to revert to English

  • Command Palette → Display Language → Select en and restart

  • Or disable/uninstall the Japanese language pack extension


5. Verify the environment with Python + BeautifulSoup

First, create a virtual environment:

conda create -n scraping python=3.12
conda activate scraping

Install BeautifulSoup and requests:

pip install beautifulsoup4 requests

Test code example (test.py):

import requests
from bs4 import BeautifulSoup

url = "https://www.example.com/"
res = requests.get(url)
soup = BeautifulSoup(res.text, "html.parser")

print(soup.title.string)

Execute:

python test.py

6. Summary

  • Anaconda is a "convenient tool that lets you finish environment setup all at once"

  • Although there are differences in prompts, Anaconda Prompt is basically fine

  • VS Code is now installed separately, but it can still be used with peace of mind just like in the past

  • Python + bs4 setup is also completed in a few lines

Don't be misled by terms like "AI editor" or "Copilot"; you can use it as your usual Python development environment with ease, so please rest assured.

That's all for my personal notes. I hope it's useful to someone.

Postscript


🔍 The difference between pip and conda

| 特徴        | `conda install`                     | `pip install`                 |
| ---------  | ----------------------------------- | ----------------------------- |
| 管理対象    | Pythonライブラリ+その他依存パッケージ | Pythonライブラリだけ            |
| 入手元    | Anaconda独自のリポジトリ       |Python公式の巨大リポジトリ)      |
| 安定性       | 検証済みのバイナリが多い             | 最新のライブラリが手に入るが     |
|             |                                    | 依存関係が壊れることも           |
| コマンド例   | `conda install numpy`              | `pip install numpy`            |

✅ Why do I only see "pip install" everywhere?

  1. Because pip is the standard for Python articles worldwide
    → Since PyPI is the official source, blogs and documentation are generally based on pip.

  2. Because many people do not use Anaconda
    → Articles tend to be based on pip because "anyone can use pip."

  3. PyPI gets newer versions faster
    → For example, machine learning libraries (like transformers) are released on PyPI first.


💡 How to actually use them properly?

  • Basically, prioritize conda install

    • Major libraries such as numpy / pandas / matplotlib / scikit-learn

    • Those with strong C library dependencies (e.g., opencv, scipy)

  • Use pip install for packages not in conda

    • Libraries like beautifulsoup4 and requests for web scraping

    • Libraries that require the latest version


📝 Practical rules

  1. First, search with conda search XXXX

  2. If it exists, use conda install XXXX

  3. If it does not exist, use pip install XXXX

It is okay to mix them, butit is recommended to always use them separately for each virtual environment.

  • Since beautifulsoup4 and requests are lightweight, pure Python libraries, they are often not specifically included in conda's own repositories.

  • Therefore, it is standard to install via pip.

pip install beautifulsoup4 requests

On the other hand, numpy and pandas have heavy dependencies on C libraries, so it is less troublesome to install them via conda.


👉 In short, "articles are mostly about pip simply because it is the standard," and the best practice for Anaconda users is "try conda first, and if it's not available, use pip."

いいなと思ったら応援しよう!