安装软件时,我多次发现以下错误。
$ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 24, in <module>
from software_name import PACKAGE_NAME
File "/home/username/Softwares/software_name/__init__.py", line 29, in <module>
import scipy
ImportError: No module named scipy
我可以用sudo apt-get install -y python-numpy
安装许多缺失的模块,但有时我会得到:
username@username:~/Softwares/software_name$ sudo apt-get install -y python-scipy
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-scipy is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-scipy' has no installation candidate
我真的不确定发生了什么?
您想要的包是python3-scipy
,而不是python-scipy
。它可以使用安装:
apt install python3-scipy
您最好通过pip(对于Python 2(或pip3(对于Python 3(安装scipy
。pip是Python包的包管理器。
pip install scipy
或
pip3 install scipy
如果将来遇到类似的问题,可以使用pip3搜索scipy
和相关搜索词来查找所需的包。查看manpip3
了解详细信息。