繁体   English   中英

在Virtualenv中安装Scipy

[英]Installing Scipy in Virtualenv

我尝试了许多安装scipy的方法,但没有成功。 我在Linux Mate上使用virtualenv。 在workon命令之后,我尝试了

pip install scipy

要么

easy_install scipy

每次结束都是“失败,退出状态为1”

我也尝试过

apt-get install python-scipy

而且我没有错误,但是如果我运行python

python
import scipy

我将看到“ ImportError:没有名为scipy的模块”这是什么问题?

我建议使用Miniconda安装scipy。

wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
bash Miniconda-latest-Linux-x86_64.sh -b

然后,创建一个安装了scipy的Conda环境:

conda create -n scipy scipy

现在,您可以访问用于打开和关闭Conda环境的activatedeactivate脚本。

$ source activate scipy
discarding /Users/username/miniconda/bin from PATH
prepending /Users/username/miniconda/envs/scipy/bin to PATH
(scipy)$ python
Python 2.7.11 |Continuum Analytics, Inc.| (default, Dec  6 2015, 18:57:58) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import scipy
>>> scipy.version.version
'0.16.0'

[编辑]您表示要使用在virtualenv中通过apt成功安装的系统安装scipy软件包。 您可以指示virtualenv创建一个包含所有系统Python软件包的新环境,如下所示:

$ virtualenv --system-site-packages scipy_env
New python executable in scipy_env/bin/python
Installing setuptools, pip...done.
$ source scipy_env/bin/activate
(scipy_env)$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM