我尝试过很多方法来安装scipy但没有成功。我在Linux Mate上使用virtualenv。 在workon命令之后我尝试了
pip install scipy
或
easy_install scipy
每次结束都是“退出状态1失败”
我也尝试了
apt-get install python-scipy
我没有错误但是如果我运行python
python
import scipy
我会有“ImportError:没有名为scipy的模块” 有什么问题?
答案 0 :(得分:1)
我建议使用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环境的activate
和deactivate
脚本。
$ 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