--As the title suggests, this is a memo of what to do immediately after installing Anaconda. --For beginners. However, it is for people who have experience with other programming languages and want to do machine learning or something complicated. --Environment: --windows 10 (OS-dependent stories are few) - Anaconda3-2019-10 --This is the story immediately after installing Anaconda and before trying to add a package. ――The necessary information is basically explained on another site, so it is a summary or almost a memorandum.
――When you use python for business such as machine learning and web application development, you basically add the packages you need.
--There are many explanations on how to add packages on the premise of one of the different package managers in the information on the Web, so you need to understand the difference yourself and rewrite it as needed, not simply copy and paste.
--So, let's understand the keywords such as conda
(as a package management tool), pip
, conda-forge
.
--qiita article: Organize information for dealing with Anaconda (focusing on Python installation method and package management method)
--qiita article: What is the difference between pip
and conda
?
--qiita article: How to change the repository destination that conda looks for (adding conda-forge)
-conda and pip: Danger of mixing
――I think you should also know about pip
and pip3
.
- https://teratail.com/questions/46066
――In short, it is safer not to mix pip
and conda
.
――No matter how careful you are when adding packages, the environment often breaks, and especially for machine learning frameworks, you want an independent environment that is highly dependent on the package version.
--In addition, there are many articles and explanations that beginners need to suddenly create a virtual environment, and above all, there is a possibility that they will lose their motivation unless they fail to build the environment and reinstall Anaconda. There are also, so I think it is necessary.
――By the way, conda
also has a function as a virtual environment management tool.
--First, let's understand the virtual environment by referring to this Site.
――As explained on this site, you can also use pip inside the virtual environment of conda.
――And it is enough if you can understand the environment including not only the package but also the interpreter.
--qiita article: pyenv, pyenv-virtualenv, venv, Anaconda, Pipenv. I use Pipenv.
--Let's use conda
because it's Anaconda.
--Creating a virtual environment is very easy.
--Start Anaconda Prompt
--First, get the latest version of conda
conda update -n base -c defaults conda
--Create a virtual environment
conda create -n myenv python=3.7
-* Myenv sets an arbitrary character string with the virtual environment name, python = 3.7 is the version specification of python
--Confirm that it has been created.
conda info -e
--Switch virtual environment
conda activate myenv
--Install the required packages. --However, do not mix pip and conda --The following sites are useful for deepening your understanding of other commands. --qiita article: [Python] Create a virtual environment with Anaconda --qiita article: Anaconda command list memo - https://www.python.jp/install/anaconda/conda.html --It also describes how to clone the base.
――If you get lost for the time being, use VS Code, there is a lot of information. Pycharm may be fine. Before VS Code became popular, I continued to use Spider, but I didn't find it easy to code and debug. --After installing VSCode, when you open the py file, it will notify you of extension candidates and proceed to follow the flow, "Python extension for Visual Studio Code" will be installed and you can do most of the things Will be. --You can switch the virtual environment by clicking base: conda at the bottom left. --You can debug with F5 ――I can execute it, but I am annoyed with the following error displayed on Terminal. I think this only happens on Windows.
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
--The error is no longer displayed.
--Understand package management tools and virtual environments. ――If the development environment goes safely, use VS Code.
Recommended Posts