我已经在amazon ec2微实例(Ubuntu 13.04)上的默认python编译器中成功地安装了scipy
。但是,我无法在virtualenv中安装scipy
。
pip install scipy
以该错误结束
scipy/sparse/sparsetools/csr_wrap.cxx: In function ‘void init_csr()’:
scipy/sparse/sparsetools/csr_wrap.cxx:73303:21: warning: variable ‘md’ set but not used [-Wunused-but-set-variable]
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
----------------------------------------
Cleaning up...
Command /home/ubuntu/pnr/bin/python -c "import setuptools;__file__='/home/ubuntu/pnr/build/scipy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-t8Drvd-record/install-record.txt --single-version-externally-managed --install-headers /home/ubuntu/pnr/include/site/python2.7 failed with error code -9 in /home/ubuntu/pnr/build/scipy
以及
Traceback (most recent call last):
File "/home/ubuntu/pnr/bin/pip", line 9, in <module>
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "/home/ubuntu/pnr/local/lib/python2.7/site-packages/pip/__init__.py", line 148, in main
return command.main(args[1:], options)
File "/home/ubuntu/pnr/local/lib/python2.7/site-packages/pip/basecommand.py", line 169, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 53: ordinal not in range(128)
在别人问之前。pip freeze
默认编译器返回
Cheetah==2.4.4
Landscape-Client==12.12
M2Crypto==0.21.1
PAM==0.4.2
Pillow==2.0.0
PyYAML==3.10
Twisted-Core==12.3.0
Twisted-Names==12.3.0
Twisted-Web==12.3.0
apt-xapian-index==0.45
argparse==1.2.1
boto==2.3.0
chardet==2.0.1
cloud-init==0.7.2
configobj==4.7.2
distribute==0.6.34
distro-info==0.10
euca2ools==2.1.1
numpy==1.7.1
oauth==1.0.1
paramiko==1.7.7.1
prettytable==0.6.1
pyOpenSSL==0.13
pycrypto==2.6
pycurl==7.19.0
pygobject==3.8.0
pyserial==2.6
python-apt==0.8.8ubuntu6
python-debian==0.1.21-nmu2ubuntu1
requests==1.1.0
scipy==0.11.0
six==1.2.0
ssh-import-id==3.14
urllib3==1.5
virtualenv==1.10.1
wsgiref==0.1.2
zope.interface==4.0.5
用于virtualenv返回的pip freeze
命令
Cython==0.19.2
Flask==0.10.1
Flask-Bootstrap==3.0.0.1
Flask-WTF==0.9.3
Jinja2==2.7.1
MarkupSafe==0.18
WTForms==1.0.5
Werkzeug==0.9.4
argparse==1.2.1
beautifulsoup4==4.3.2
itsdangerous==0.23
numpy==1.7.1
pymongo==2.6.2
requests==2.0.0
wsgiref==0.1.2
您最好的选择是将Scipy构建为二进制包(bdist,或eggs,或更现代的wheels),例如,通过
python setupegg.py bdist_egg
在具有兼容环境的不同计算机上。例如,在虚拟机中使用类似于EC2实例的Linux版本。一般来说,最好记住当
pip
安装包时,它编译源文件。如果包不是很小,那么效率很低,最好使用二进制包。wheel
包格式应该与pip一起使用。这对我有效:
见:
Memory error while using pip install Matplotlib
https://github.com/pypa/pip/blob/9a23d4ed119327d3b823ec223aaead90964bac58/pip/basecommand.py#L56-L63
https://github.com/pypa/pip/blob/28cca11e284b37cc2c7977fd25be6f494adda9d3/src/pip/_internal/download.py#L359-L367
注意:
一种解决方案是在微实例上临时启用交换。如本SO post所述,通过以下方式启用1gb交换:
打开swap后,通过pip安装scipy:
一旦scipy成功安装,您可以通过以下方式禁用它:
相关问题 更多 >
编程相关推荐