Understanding of conda and pip

When installing some python installation packages, we will use conda install ~ or pip install ~

It is said on the Internet that conda is installed in the cloud, while pip is installed locally. What is the difference between the two? You can refer to this and click to open the link.

Here is my understanding:

If we focus on just installing Python packages, conda and pip serve different audiences and different purposes. If you want to manage Python packages in an existing system Python installation, conda can't help you: by design, it can only install packages in a conda environment. If you want to say, use many Python packages that depend on external dependencies (NumPy, SciPy and Matplotlib are common examples), while keeping track of those dependencies in a meaningful way, pip can't help you: it manages Python packages and only Python Bag.

  Conda and pip are not competitors, but tools that focus on different user groups and usage patterns. Conda is a general-purpose package manager, originally designed to manage packages in any language. So, of course, the goals of Conda and pip are different for managing python packages, and only a small subset of them have intersections and competitions: such as python package installation and environment isolation. pip allows you to install python packages in any environment, and conda allows you to install any language package (including c or python) in the conda environment.

Example: I need to use the pygame installation package when I practice the alien invasion of this 2D game. I can't directly input conda install pygame or pip install pygame at the cmd or anaconda prompt. Because my anaconda integrates python3.6 and python3.5 (tensorflow), neither of the two methods just used will directly identify and install the pygame installation package into the local environment, that is, you need to specify a local installation environment, After I activated tensorflow, I typed pip install pygame and the pygame installation was successful. Here is the test code:

import sys
import pygame
def run_game():
    # Initialize the game and create a screen object
    pygame.init()
    screen = pygame.display.set_mode((1200, 800))
    pygame.display.set_caption("Alien Invasion")
    # Start the main loop of the game
    while True:
        # Monitor keyboard and mouse events
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        # Make the most recently drawn screen visible
        pygame.display.flip()
run_game()



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324736889&siteId=291194637