Scipy 安装到 Mountain Lion 上的错误位置? [英] Scipy Installing to Wrong Place on Mountain Lion?

查看:30
本文介绍了Scipy 安装到 Mountain Lion 上的错误位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在 Mountain Lion 上安装 scipy,除了:

Tried installing scipy on Mountain Lion, and couldn't get anything to work except:

sudo pip install -e git+https://github.com/scipy/scipy#egg=scipy-dev

sudo pip install -e git+https://github.com/scipy/scipy#egg=scipy-dev

我相信它安装了 scipy 的开发版本.出于某种原因,它在我当前的文件夹中留下了一个 src 目录,其中包含一个 pip-delete-this-directory.txtscipy 目录,其中包含所有 scipy 文件.我可以从任何地方导入 scipy,但删除此文件夹会完全删除 scipy.怎么回事?

which I believe installs the development version of scipy. For some reason it leaves an src directory inside my current folder, which contains a pip-delete-this-directory.txt and scipy directory containing all scipy files. I can import scipy from anywhere, but removing this folder removes scipy entirely. What's going on?

如果我尝试使用简单的 sudo pip install scipy 进行安装,我会得到以下内容

If I try installing with simply sudo pip install scipy, I get the following

/System/Library/Frameworks/vecLib.framework/Headers/vecLib.h:22:4: error: "<vecLib/vecLib.h> is deprecated.  Please #include <Accelerate/Accelerate.h> and link to Accelerate.framework."

                #error "<vecLib/vecLib.h> is deprecated.  Please #include <Accelerate/Accelerate.h> and link to Accelerate.framework."

                 ^

1 error generated.

error: Command "clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Iscipy/sparse/linalg/eigen/arpack/ARPACK/SRC -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c -o build/temp.macosx-10.8-intel-2.7/scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.o" failed with exit status 1

推荐答案

来自 pip 文档页面:

编辑模式包通常安装在站点包下,但是当您进行更改时,直接从签出的源代码树中运行包更有意义.可编辑"安装在站点包中创建一个 .pth 文件,扩展 Python 的导入路径以查找包:

Edit mode Packages normally install under site-packages, but when you’re making changes, it makes more sense to run the package straight from the checked-out source tree. "Editable" installs create a .pth file in site-packages that extends Python’s import path to find the package:

$ pip install -e path/to/SomePackage

所以这意味着你可以简单地通过运行来解决你的问题:

So this means you can simply solve your problems by running:

 $ sudo mv src/scipy/scipy /Library/Python/2.7/site-packages/

然后如果你想干净,你可以编辑文件以删除由 pip 添加的行:

And then if you want to be clean, you can edit the file to remove the line that was added by pip:

 $ sudo vim /Library/Python/2.7/site-packages/easy-install.pth

这篇关于Scipy 安装到 Mountain Lion 上的错误位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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