Anaconda and Pycharm ultra-detailed installation tutorial (2023 version + Win11)


foreword

When doing Python development, it is very important to use a suitable development environment. Anaconda and PyCharm are two popular tools that provide powerful functions and convenient interfaces, allowing us to write and manage Python projects more efficiently. This blog will introduce in detail how to install and configure Anaconda and PyCharm, so that you can get started quickly and enjoy programming.

1. What is Anaconda?

Anaconda is a Python distribution for scientific computing and data analysis. It contains a series of commonly used scientific computing libraries and tools, such as NumPy, SciPy, Pandas, and Jupyter Notebook. Anaconda also provides a handy environment management tool that makes it easy to create and manage Python virtual environments.

2. Why choose Anaconda?

Anaconda has the following advantages:
- A large number of commonly used scientific computing libraries are pre-installed, avoiding the cumbersome installation process.
- Provides a convenient environment management tool to create and switch between different Python environments.
- Multi-platform compatible, runs on Windows, Linux and macOS.

3. Install Anaconda

3.1. Download Anaconda

Download the Anaconda installation package for your operating system from the official website ( Free Download | Anaconda ).

(here take windows as an example)

3.2. Install Anaconda

Open the downloaded installation package and follow the instructions of the installation wizard to install it. During the installation process, you can choose the default installation options, or you can customize the settings according to your needs.

(Choose "Next" first)

(Then select "I Agree")

(Choose Just Me here, you must choose this, and it will be guaranteed to be in the Anaconda directory when you make a virtual environment later)

(then click "Next")

(Choose the installation path here. It is best to choose a path other than the C drive. If you only have the C drive, then I didn’t say it hahaha~) 

(Click "Next" again)

(Then select the installation option, just select all here, or you can choose according to your own needs, do not force, the Chinese explanation is attached below)

E: Create start shortcuts (supported packages only).

Medium: Create a start shortcut (packages only).

E: Add Anaconda3 to my PATH environment variable

Medium: Add Anaconda3 to my PATH environment variable

E: Register Anaconda3 as my default Python 3.10
: Register Anaconda3 as my default Python 3.10
E: Recomended. Allows other programs, such as VSCode, PyCharm, etc. to automatically detect Anaconda3 as the primary Python 3.10 on the system.

Middle: Recommended. Allows other programs such as VSCode, PyCharm, etc. to automatically detect Anaconda3 as the main Python 3.10 on the system.
E: Clear the package cache upon completion

Middle: Clear package cache after completion
E: Recommended. Recovers some disk space without harming functionality.
Middle: Recommended. Recover some disk space without compromising functionality.

E: Not recommended.   This can lead to conflicts with other applications.   Instead, use the Command Prompt and Powershell menus added to the Windows Start Menu.

Medium: Not recommended. This may cause conflicts with other applications. Instead, use the Command Prompt and Powershell menus added to the Windows Start menu.

(Finally, just wait for the download to finish, then continue to "Next", and finally "Finish" to complete the installation!)

3.3. Verify Anaconda

Open the win key, and "Anaconda Prompt" is displayed on it, click and enter the following commands to verify:

conda -V
python -V

 (If the version number appears, the installation is successful!)

3.4. Add domestic source for Anaconda

It is this shell interface again, enter the following command to add domestic sources.

(Check the domestic source image added by yourself)

conda config --show channels

(Delete all domestic source images added by yourself)

conda config --remove-key channels

(Add and configure domestic source mirroring)

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/
conda config --add https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

(Configure and confirm domestic source mirroring) 

conda config --set show_channel_urls yes

 (Re-enter the command to view the domestic source image added by yourself)

conda config --show channels

4. What is PyCharm?

PyCharm is a Python integrated development environment (IDE) developed by JetBrains. It provides a wealth of features, including code auto-completion, debugger, version control integration, etc., allowing developers to write and debug Python code more efficiently.

5. Why choose PyCharm?

PyCharm has the following advantages:

  • Powerful code editing and debugging functions can improve coding efficiency and code quality.
  • Multiple project types are supported, including web development, data science, machine learning, and more.
  • Provides a wealth of plug-ins and extensions, which can be customized and extended according to individual needs.
  • Cross-platform support, runs on Windows, Linux and macOS.

6. Install PyCharm (2023.1.2 Pro version)

Open the downloaded installation package and follow the instructions of the installation wizard to install it. You can choose to install the Professional Edition (Professional Edition) or the Community Edition (Community Edition) to choose according to your needs.

Installation site: PyCharm: the Python IDE for Professional Developers by JetBrains

(here takes the professional version as an example)

 

(click "Next")

 (Select the path, click "Next")

 (Not all are selected by default, I will select all here, and then click "Next")

(Then just wait for the installation, and then "Finish" to complete the installation)

Seven, configure Anaconda and PyCharm

7.1 Create and manage virtual environments

Virtual environments can be easily created and managed using the commands provided by Anaconda or the Anaconda Navigator interface. Virtual environments can isolate the dependencies of different projects and ensure that they do not interfere with each other.

  • Open Anaconda Prompt
  • Enter the create virtual environment command
conda create -n 环境名 python=3.8

 

 Enter y to proceed to the next step

 Enter conda activate + environment name to enter the virtual environment. (My environment name here is: YOLOv8-GUI)

conda activate YOLOv8-GUI

 Enter the following command to exit the virtual environment

conda deactivate

 Enter the following command to view the name and location path of the virtual environment

conda env list

 In this way, the virtual environment is configured, and then enter pycharm to import the virtual environment into it.

7.2 Configure PyCharm interpreter

Open PyCharm, go to the file -> Preferences interface, and find the interpreter option. Select the Anaconda environment you want to use as the interpreter and configure it.

 Then click Add Local Interpreter, import the location path of the virtual environment, and select python.exe.

 

 

 Then click "OK" to import the virtual environment into pycharm.

Attach the pip domestic mirror source

pip uses Tsinghua source image source

pip install <library> -i https://pypi.tuna.tsinghua.edu.cn/simple/

pip uses Douban's mirror source

pip install <library> -i https://pypi.douban.com/simple/

pip uses the mirror source of University of Science and Technology of China

pip install <library> -i https://pypi.mirrors.ustc.edu.cn/simple/

pip uses Alibaba Cloud's mirror source

pip install <library> -i http://mirrors.aliyun.com/pypi/simple/


8. Summary

This blog details how to install and configure Anaconda and PyCharm. By installing Anaconda, you can get powerful scientific computing libraries and environment management tools. And PyCharm provides you with an excellent Python development environment, allowing you to write and debug code more efficiently. Hope this tutorial can help you get started easily and enjoy the fun of programming!

Guess you like

Origin blog.csdn.net/Little_Carter/article/details/131031595