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

2024-06-16 09:43:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试在Synology服务器上运行Python脚本。到目前为止,我设法安装了必要的库,如requests、bs4和cython。这很有效。但是我一直使用numpy和pandas,它们返回以下错误输出

它与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.

Tags: installpipandpyimportnumpyversionpackages
2条回答

我重新记录了皮普:

easy_install -U pip

然后安装熊猫

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

要获得一个allready编译的numpy控制盘,您可以下载一个包含numpy的安装包(spk)(即https://synocommunity.com/package/homeassistant上的home assistant core)并从该包中提取控制盘。 因此,您可以使用7-Zip(或其他打包程序)从spk文件中提取package.tgz。 在package.tgz中,您可以在share/wheelhouse(当前为numpy-1.19.2-cp38-none-any.whl)下找到车轮。 提示:忽略控制盘名称中的“none any”,因为事实上它是为特定于spk的cpu arch交叉编译的

最后,将控制盘复制到NAS中,并使用 pip install numpy-1.19.2-cp38-none-any.whl

相关问题 更多 >