在 MacOS 10.10 上安装 NumPy for Python 3.6 时出现错误

问题描述 投票:0回答:1

我正在尝试使用 Python 3.6 在 MacOS 10.10 上安装 NumPy。我是Python新手。我收到如下所示的错误。我将非常感谢任何克服这个问题的建议。我尝试了以下方法:

第一种方法

$ brew install homebrew/python/numpy

Error: /usr/local/Cellar is not writable. You should change the
ownership and permissions of /usr/local/Cellar back to your
user account:
  sudo chown -R $(whoami) /usr/local/Cellar
==> Tapping homebrew/python
fatal: could not create work tree dir '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-python': Permission denied
Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-python /usr/local/Homebrew/Library/Taps/homebrew/homebrew-python --depth=1

第二种方法

$ pip3 install numpy

Collecting numpy
  Using cached numpy-1.12.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Installing collected packages: numpy
Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy'
macos python-3.x numpy
1个回答
1
投票

使用 anaconda 发行版! 它将安装在您的用户目录中 并为您省去 sudo 带来的麻烦。并得到你 一个正常运行的 numpy/scipy 堆栈。

https://www.continuum.io/downloads

© www.soinside.com 2019 - 2024. All rights reserved.