繁体   English   中英

为什么在 Linux (NAS) 上安装 pandas 时出现错误?

[英]Why do I get an error installing pandas on Linux (NAS)?

我一直在尝试让我的 Python 脚本在我的 Synology 服务器上运行。 到目前为止,我设法安装了必要的库,例如 requests、bs4 和 cython。 这样可行。 但是我被 numpy 和 pandas 卡住了,它们返回以下错误 output。

它与 pip 无关(在 Stackoverflow 上的另一个问题中建议),因为我已经使用了最新版本。

谁能帮我吗?

编辑:安装 Python 3.8

ERROR: Command errored out with exit status 1:
   command: /var/packages/py3k/target/usr/local/bin/python3 /var/packages/py3k/target/usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-cbb90c2z/overlay --no-warn-script
-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.15.4; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.15.4; python_ver
sion=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' 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'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"''

       cwd: None

  Complete output (87 lines):

  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

  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

  Ignoring numpy: markers 'python_version == "3.8" and platform_system == "AIX"' don't match your environment

  Ignoring numpy: markers 'python_version >= "3.9"' don't match your environment

  Collecting setuptools

    Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)

  Collecting wheel

    Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)

  Collecting Cython<3,>=0.29.21

    Using cached Cython-0.29.21-py2.py3-none-any.whl (974 kB)

  Collecting numpy==1.17.3

    Using cached numpy-1.17.3.zip (6.4 MB)

  Building wheels for collected packages: numpy

    Building wheel for numpy (setup.py): started

    Building wheel for numpy (setup.py): finished with status 'error'

    ERROR: Command errored out with exit status 1:

     command: /var/packages/py3k/target/usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ltbznc4c/numpy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ltbznc4c/numpy/setup.py'"'
"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-caq_alpn

         cwd: /tmp/pip-install-ltbznc4c/numpy/

    Complete output (14 lines):

    Running from numpy source directory.

    Traceback (most recent call last):

      File "<string>", line 1, in <module>

      File "/tmp/pip-install-ltbznc4c/numpy/setup.py", line 443, in <module>

        setup_package()

      File "/tmp/pip-install-ltbznc4c/numpy/setup.py", line 422, in setup_package

        from numpy.distutils.core import setup

      File "/tmp/pip-install-ltbznc4c/numpy/numpy/distutils/core.py", line 26, in <module>

        from numpy.distutils.command import config, config_compiler, \

      File "/tmp/pip-install-ltbznc4c/numpy/numpy/distutils/command/config.py", line 20, in <module>

        from numpy.distutils.mingw32ccompiler import generate_manifest

      File "/tmp/pip-install-ltbznc4c/numpy/numpy/distutils/mingw32ccompiler.py", line 31, in <module>

        import distutils.cygwinccompiler

    ModuleNotFoundError: No module named 'distutils.cygwinccompiler'

    ----------------------------------------

    ERROR: Failed building wheel for numpy

    Running setup.py clean for numpy

    ERROR: Command errored out with exit status 1:

     command: /var/packages/py3k/target/usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ltbznc4c/numpy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ltbznc4c/numpy/setup.py'"'
"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all

         cwd: /tmp/pip-install-ltbznc4c/numpy

    Complete output (10 lines):

    Running from numpy source directory.

    `setup.py clean` is not supported, use one of the following instead:

      - `git clean -xdf` (cleans all files)

      - `git clean -Xdf` (cleans all versioned files, doesn't touch

                          files that aren't checked into the git repo)

    Add `--force` to your command to use it anyway if you must (unsupported).

    ----------------------------------------

    ERROR: Failed cleaning build dir for numpy

  Failed to build numpy

  Installing collected packages: setuptools, wheel, Cython, numpy

      Running setup.py install for numpy: started

      Running setup.py install for numpy: finished with status 'error'

      ERROR: Command errored out with exit status 1:

       command: /var/packages/py3k/target/usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ltbznc4c/numpy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ltbznc4c/numpy/setup.py'
"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-l0tp9bsn/install-record.txt
 --single-version-externally-managed --prefix /tmp/pip-build-env-cbb90c2z/overlay --compile --install-headers /tmp/pip-build-env-cbb90c2z/overlay/include/python3.8/numpy

           cwd: /tmp/pip-install-ltbznc4c/numpy/

      Complete output (23 lines):

      Running from numpy source directory.

      Note: if you need reliable uninstall behavior, then install

      with pip instead of using `setup.py install`:

        - `pip install .`       (from a git repo or downloaded source

                                 release)

        - `pip install numpy`   (last NumPy release on PyPi)

      Traceback (most recent call last):

        File "<string>", line 1, in <module>

        File "/tmp/pip-install-ltbznc4c/numpy/setup.py", line 443, in <module>

          setup_package()

        File "/tmp/pip-install-ltbznc4c/numpy/setup.py", line 422, in setup_package

          from numpy.distutils.core import setup

        File "/tmp/pip-install-ltbznc4c/numpy/numpy/distutils/core.py", line 26, in <module>

          from numpy.distutils.command import config, config_compiler, \

        File "/tmp/pip-install-ltbznc4c/numpy/numpy/distutils/command/config.py", line 20, in <module>

          from numpy.distutils.mingw32ccompiler import generate_manifest

        File "/tmp/pip-install-ltbznc4c/numpy/numpy/distutils/mingw32ccompiler.py", line 31, in <module>

          import distutils.cygwinccompiler

      ModuleNotFoundError: No module named 'distutils.cygwinccompiler'

      ----------------------------------------

  ERROR: Command errored out with exit status 1: /var/packages/py3k/target/usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ltbznc4c/numpy/setup.py'"'"'; __file__='"'"'/tmp/pip
-install-ltbznc4c/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-r
ecord-l0tp9bsn/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-cbb90c2z/overlay --compile --install-headers /tmp/pip-build-env-cbb90c2z/overlay/include/python3.8/numpy Check the logs for full
 command output.

  ----------------------------------------

ERROR: Command errored out with exit status 1: /var/packages/py3k/target/usr/local/bin/python3 /var/packages/py3k/target/usr/local/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-en
v-cbb90c2z/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.15.4; python_version=='"'"'3.6'"'"' and platform_system!='"'"'A
IX'"'"'' 'numpy==1.15.4; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and pla
tform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'
"'"'' Check the logs for full command output.

我重新安装了 pip:

easy_install -U pip

然后安装pandas

pip install pandas

我想您的 NAS 没有 x64 cpu,并且 pip 无法为您的 cpu 架构找到 numpy。 所以你需要一个为你的 cpu 交叉编译的 numpy 的轮子。

您的日志显示ModuleNotFoundError: No module named 'distutils.cygwinccompiler'因为它试图在安装时编译轮子。 您的 NAS 上没有安装构建工具链,因此您需要在另一个系统上交叉编译轮子。

您可以在https://github.com/SynoCommunity/spksrc中找到交叉构建环境。 在那里你可以在https://github.com/SynoCommunity/spksrc/tree/master/cross/numpy下找到 numpy 。

To get an allready compiled wheel of numpy you might download an installation package (spk) that includes numpy (ie home assistant core on https://synocommunity.com/package/homeassistant ) and extract the wheel from the package. 因此,您可以使用 7-Zip(或其他打包程序)从 spk 文件中提取 package.tgz。 在 package.tgz 中,您可以在 share/wheelhouse 下找到轮子(当前为 numpy-1.19.2-cp38-none-any.whl)。 提示:忽略轮子名称中的“none-any”,因为实际上它是为特定于 spk 的 cpu 拱门交叉编译的。

最后将轮子复制到您的 NAS 并使用pip install numpy-1.19.2-cp38-none-any.whl安装它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM