Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法在Ubuntu上安装scipy_Python_Scipy_Installation_Failed Installation - Fatal编程技术网

Python 无法在Ubuntu上安装scipy

Python 无法在Ubuntu上安装scipy,python,scipy,installation,failed-installation,Python,Scipy,Installation,Failed Installation,我正在尝试在Linux Ubuntu上安装scipy: 我正在使用以下命令: pip install scipy 但我有一个错误: Collecting scipy Using cached https://files.pythonhosted.org/packages/ee/5b/5afcd1c46f97b3c2ac3489dbc95d6ca28eacf8e3634e51f495da68d97f0f/scipy-1.3.1.tar.gz Installing build depend

我正在尝试在Linux Ubuntu上安装scipy:

我正在使用以下命令:

pip install scipy
但我有一个错误:

Collecting scipy
  Using cached https://files.pythonhosted.org/packages/ee/5b/5afcd1c46f97b3c2ac3489dbc95d6ca28eacf8e3634e51f495da68d97f0f/scipy-1.3.1.tar.gz
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-x5wy9z29/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel setuptools 'Cython>=0.29.2' 'numpy==1.13.3; python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version>='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"''
       cwd: None
  Complete output (28 lines):
  Ignoring numpy: markers 'python_version == "3.5" and platform_system != "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.5" and platform_system == "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.6" and platform_system == "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version >= "3.7" and platform_system == "AIX"' don't match your environment
  Collecting wheel
    Using cached https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl
  Collecting setuptools
    Using cached https://files.pythonhosted.org/packages/d9/de/554b6310ac87c5b921bc45634b07b11394fe63bc4cb5176f5240addf18ab/setuptools-41.6.0-py2.py3-none-any.whl
  Collecting Cython>=0.29.2
    Using cached https://files.pythonhosted.org/packages/a5/1f/c7c5450c60a90ce058b47ecf60bb5be2bfe46f952ed1d3b95d1d677588be/Cython-0.29.13.tar.gz
      ERROR: Command errored out with exit status 1:
       command: /usr/local/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uksqh3vn/Cython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uksqh3vn/Cython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-uksqh3vn/Cython/pip-egg-info
           cwd: /tmp/pip-install-uksqh3vn/Cython/
      Complete output (11 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
          from setuptools.dist import Distribution, Feature
        File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 36, in <module>
          from setuptools import windows_support
        File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
          import ctypes
        File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
          from _ctypes import Union, Structure, Array
      ModuleNotFoundError: No module named '_ctypes'
      ----------------------------------------
  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 /usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-x5wy9z29/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel setuptools 'Cython>=0.29.2' 'numpy==1.13.3; python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version>='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' Check the logs for full command output.
而且效果很好

编辑:当我把:

sudo apt-get install python-scipy
我得到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-scipy is already the newest version (0.17.0-1).
Python 3.8.0 (default, Oct 29 2019, 14:49:17) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy'
但如果我只是输入代码:

import scipy
我得到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-scipy is already the newest version (0.17.0-1).
Python 3.8.0 (default, Oct 29 2019, 14:49:17) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy'

您可以使用以下方式安装它:

sudo apt-get install python3-numpy python3-scipy


您可以使用以下方式安装它:

sudo apt-get install python3-numpy python3-scipy


我用更多的信息编辑了这篇文章。谢谢。在这种情况下,正如@smci所提到的,您可以更好地创建和使用env,因为您有多个python版本。这在Anaconda中很容易管理。我用更多的信息编辑了这篇文章。谢谢。在这种情况下,正如@smci所提到的,您可以更好地创建和使用env,因为您有多个python版本。这可以在Anaconda中轻松管理。您有多个安装:目前您有Python 3.8,但安装失败后的错误消息告诉您,它在Python 3.5、3.6、3.7下找到了以前安装的组件。查看有关使用Anaconda或虚拟环境的所有现有问题。类型上的ModuleNotFounderror是可疑的。您是否也可以导入numpy,或者在尝试时是否会引发错误?如果是一个选项,则最好清除所有不必要的python版本,然后使用1个漂亮的设置。这是否回答了您的问题?我在import numpy中遇到了同样的错误@AndrasDeakYou有多个安装:目前有Python3.8,但安装失败后的错误消息告诉您,它在Python3.5、3.6、3.7下找到了以前安装的组件。查看有关使用Anaconda或虚拟环境的所有现有问题。类型上的ModuleNotFounderror是可疑的。您是否也可以导入numpy,或者在尝试时是否会引发错误?如果是一个选项,则最好清除所有不必要的python版本,然后使用1个漂亮的设置。这是否回答了您的问题?我在import numpy中遇到了同样的错误@安德拉斯达克