In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to configure Python Anaconda". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to configure Python Anaconda.
What are the two biggest headaches in writing Python code?
1. The Windows platform often fails to install third-party packages. Do you remember the scenario when you first installed the mysql dependency package? I can't fit it.
2. the problem of virtual environment switching, if we develop multiple projects on the same computer at the same time, it is very necessary for each project to have an independent virtual environment, but it is also troublesome to cut back and forth between different projects.
These two questions Anoconda can save you.
What is Anaconda?
Anaconda is a Python distribution that can be used for scientific computing, supporting Linux, Mac, Windows systems, and built-in commonly used scientific computing packages. It solves two major pain points of the official Python.
To sum up, it is a more powerful installation package than the Python official.
First:
The package management function is provided, and the scenarios of frequent failures in installing third-party packages on the Windows platform can be solved.
Second:
It provides the function of environmental management, which is similar to Virtualenv, and solves the problem of coexistence and switching of multi-version Python.
Download Anaconda
Download the installation package directly from the official website, select the installation package of Python3.8, and install it directly after the download is completed. You can choose the default configuration during the installation process, which requires about 1.8g of disk space.
Conda is a tool for package management and environment management under Anaconda, which is similar to the combination of pip and vitualenv in function. After successful installation, conda is added to the environment variable by default, so you can run the command conda directly from the command line window
The environmental management of conda is basically similar to virtualenv. So as long as you have used pip or virtualenv, there is basically no migration cost.
Environment management
Create a virtual environment
Create an environment named python36 based on python3.8
Conda create-name python36 python=3.8
Activate the virtual environment
Activate python36 # windows platform
Source activate python36 # linux/mac platform
Exit the current virtual environment
Deactivate python36
Delete virtual environment
Conda remove-n python36-- all
# or
Conda env remove-n python36
View all installed virtual environments
Conda info-e
Python36 * D:\ Programs\ Anaconda3\ envs\ python36
Root D:\ Programs\ Anaconda3 package Management
Conda's package management function is the same as pip, of course, you can choose pip to install the package is no problem.
# install matplotlib
Conda install matplotlib
# View installed packages
Conda list
# package updates
Conda update matplotlib
# deleting a package
Conda remove matplotlib
With conda you no longer have to worry about not being able to install machine learning-related packages such as mysqlclient and matplotlib.
Anything is a package in conda. Conda itself can be thought of as a package, the python environment can be seen as a package, and anaconda can also be seen as a package, so these three packages also support updates in addition to ordinary third-party packages. For example:
# Update conda itself
Conda update conda
# updating anaconda App
Conda update anaconda
# update python, assuming that the current python environment is 3.6.1 and the latest version is 3.6.2, then it will be upgraded to 3.6.2
Conda update python modifies the image address
Like pip, the image address of Anaconda is abroad by default, and it will be very slow to install the package with conda. Currently, the available domestic image source address is that of Tsinghua University. Modify ~ / .condarc (Linux/Mac) or C:\ Users\ current user name\ .condarc (Windows) configuration:
Channels:
-https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
-defaults
Show_channel_urls: true
If you are still slow to use conda installation package, you can consider using pip to install it, and also change the image source address of pip to domestic. Douban source is faster. Modify ~ / .pip/pip.conf (Linux/Mac) or C:\ Users\ current user name\ pip\ pip.ini (Windows) configuration:
[global]
Trusted-host = pypi.douban.com
Index-url = http://pypi.douban.com/simple
After the configuration, your download speed is sure to fly.
At this point, I believe you have a deeper understanding of "how to configure Python Anaconda", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.