我已经尝试了一切,但无法让Scipy工作。
通过Homebrew安装了Scipy,似乎可以正常工作-但是尝试导入它时出现了错误。 卸载,通过pip3安装,没有区别。 Brew篡改,brew链接(用于Scipy和python的未链接小桶的强制链接),没有任何进展。
在macOS Mojave(10.14.6)上运行。 Numpy,matplotlib等可以正常工作。我在这里想念什么?
我安装了两个版本的python,但是Scipy应该安装在python3.7中(我正在使用)。详情请见以下
d37072:~ au341374$ brew info scipy
scipy: stable 1.3.0 (bottled), HEAD
Software for mathematics, science, and engineering
https://www.scipy.org
/usr/local/Cellar/scipy/1.3.0_1 (962 files, 47.3MB) *
Poured from bottle on 2019-09-20 at 03:39:57
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/scipy.rb
==> Dependencies
Build: swig ✔
Required: gcc ✔, numpy ✔, openblas ✔, python ✔
==> Options
--HEAD
Install HEAD version
'import sitecustomize' failed; use -v for traceback
'import sitecustomize' failed; use -v for traceback
==> Caveats
If you use system python (that comes - depending on the OS X version -
with older versions of numpy, scipy and matplotlib), you may need to
ensure that the brewed packages come earlier in Python's sys.path with:
mkdir -p /Users/au341374/Library/Python/2.7/lib/python/site-packages
echo 'import sys; sys.path.insert(1, "/usr/local/lib/python3.7/site-packages")' >> /Users/au341374/Library/Python/2.7/lib/python/site-packages/homebrew.pth
==> Analytics
install: 3,010 (30 days), 5,751 (90 days), 31,101 (365 days)
install_on_request: 2,070 (30 days), 3,613 (90 days), 19,312 (365 days)
build_error: 0 (30 days)
-
d37072:~ au341374$ pip3 install scipy
Requirement already satisfied: scipy in /usr/local/lib/python3.7/site-packages (1.3.1)
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.7/site-packages (from scipy) (1.16.4)
d37072:~ au341374$ brew install scipy
Warning: scipy 1.3.0_1 is already installed and up-to-date
To reinstall 1.3.0_1, run `brew reinstall scipy`
-
d37072:~ au341374$ brew link scipy
Warning: Already linked: /usr/local/Cellar/scipy/1.3.0_1
To relink: brew unlink scipy && brew link scipy
d37072:~ au341374$ brew link python
Warning: Already linked: /usr/local/Cellar/python/3.7.4_1
To relink: brew unlink python && brew link python
-
d37072:~ au341374$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7-config
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m-config
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3-config
/usr/local/munki/munkiwebadmin-config
-
d37072:~ au341374$ which -a python
/usr/local/bin/python
/usr/bin/python
d37072:~ au341374$ which -a pip
/usr/local/bin/pip
d37072:~ au341374$ which -a python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
/usr/local/bin/python3
d37072:~ au341374$ which -a pip3
/usr/local/bin/pip3
-
d37072:~ au341374$ pip -V
'import sitecustomize' failed; use -v for traceback
pip 19.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 2.7)
d37072:~ au341374$ pip3 -V
pip 19.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
答案 0 :(得分:0)
好吧,以某种方式不经意地修复了它。 我解开并重新安装了numpy和scipy,但无济于事。 最后卸载了numpy,scipy,matplotlib,ipython和jupyter,这样它就可以卸载python。重新安装python numpy和scipy无法修复任何问题。 然后,运行后
pip3 install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
我认为是这样做的。 Scipy和numpy现在显然已安装在
中scipy in ./Library/Python/3.7/lib/python/site-packages (1.3.1)
numpy>=1.13.3 in ./Library/Python/3.7/lib/python/site-packages (from scipy) (1.17.2)
而不是在常规的“ pip3 install scipy”正在安装它的usr / local / lib / Python3.7 / site-packages中。
现在唯一奇怪的是./Library/Python/实际上只包含一个名为2.7而不是3.7的文件夹(没有隐藏的文件夹)。 我很奇怪,但是,它有效。