[英]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環境的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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.