为什么 apt-get 功能在 Mac OS X v10.9 (Mavericks) 的终端中不起作用? [英] Why is the apt-get function not working in the terminal on Mac OS X v10.9 (Mavericks)?

查看:35
本文介绍了为什么 apt-get 功能在 Mac OS X v10.9 (Mavericks) 的终端中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在观看 this,并且如您所见,第一个命令我我被告知要输入的是:

I was watching this, and, as you can see, the first command I am told to put in is:

sudo apt-get install python-setuptools

当我这样做时,它输出:

When I do this, it outputs:

sudo: apt-get: command not found

我不知道为什么会这样.

I have no idea why this is the case.

我该如何解决这个问题才能正确地遵循教程?

How can I resolve this so I am following the tutorial correctly?

推荐答案

Mac OS X 没有 apt-get.有一个名为 Homebrew 的包管理器被用来代替.

Mac OS X doesn't have apt-get. There is a package manager called Homebrew that is used instead.

这个命令是:

brew 安装 python

brew install python

使用 Homebrew 来安装那些原本要使用 apt-get 的软件包.

Use Homebrew to install packages that you would otherwise use apt-get for.

我链接的页面有最新的homebrew安装方式,但目前可以通过如下方式安装Homebrew:

The page I linked to has an up-to-date way of installing homebrew, but at present, you can install Homebrew as follows:

在您的 Mac OS X 终端中键入以下内容:

Type the following in your Mac OS X terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

之后,Homebrew 的用法是brew install .

After that, usage of Homebrew is brew install <package>.

Homebrew 的先决条件之一是 XCode 命令行工具.

One of the prerequisites for Homebrew are the XCode command line tools.

  1. 从 App Store 安装 XCode.
  2. 按照此 Stack Overflow 答案中的说明安装 XCode 命令行工具.

背景

包管理器(如 apt-getbrew)只是为您的系统提供了一种简单且自动化的方式来安装包或库.不同的系统使用不同的程序.apt 及其衍生工具用于基于 Debian 的 linux 系统.Red Hat-ish Linux 系统使用 rpm(或者至少他们在很多很多年前使用过).yum 也是基于 RedHat 的系统的包管理器.

Background

A package manager (like apt-get or brew) just gives your system an easy and automated way to install packages or libraries. Different systems use different programs. apt and its derivatives are used on Debian based linux systems. Red Hat-ish Linux systems use rpm (or at least they did many, many, years ago). yum is also a package manager for RedHat based systems.

基于 Alpine 的系统使用 apk.

Alpine based systems use apk.

截至 2016 年 4 月 25 日,默认情况下,自制软件会选择用户发送分析数据.可以通过两种方式选择退出:

As of 25 April 2016, homebrew opts the user in to sending analytics by default. This can be opted out of in two ways:

设置环境变量:

  1. 打开您的最喜欢的环境变量编辑器.
  2. 设置以下内容:HOMEBREW_NO_ANALYTICS=1 在您保存环境变量的任何位置(通常类似于 ~/.bash_profile)
  3. 关闭文件,然后重新启动终端或 source ~/.bash_profile.
  1. Open your favorite environment variable editor.
  2. Set the following: HOMEBREW_NO_ANALYTICS=1 in whereever you keep your environment variables (typically something like ~/.bash_profile)
  3. Close the file, and either restart the terminal or source ~/.bash_profile.

运行以下命令:

brew analytics off

然后可以使用以下命令检查分析状态:

the analytics status can then be checked with the command:

brew analytics

这篇关于为什么 apt-get 功能在 Mac OS X v10.9 (Mavericks) 的终端中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆