0

Ubuntu 20.04.2 我在 virtualenv 中使用 python2.7(因为我尝试构建的程序不适用于我的 3.8) pip 20.3.4

我正在尝试运行的程序(涉及 tensorflow)附带一个文件,其中包含安装所需的所有内容(我认为这是一个 dockerfile?)。当我尝试运行该程序时,我收到有关 dockerfile 中的一项错误 - resampy。

我得到一个ImportError:No module resampy

我做了一个pip install resampy

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Processing /home/pete/.cache/pip/wheels/19/90/bb/f45e7cc1cfc8f5299c12511fccefcca90c801de995a4e7eb00/resampy-0.2.2-py2-none-any.whl
Collecting numba>=0.32
  Using cached numba-0.47.0-cp27-cp27mu-manylinux1_x86_64.whl (3.6 MB)
Requirement already satisfied: numpy>=1.10 in /home/pete/env/py2.7/lib/python2.7/site-packages (from resampy) (1.13.1)
Requirement already satisfied: scipy>=0.13 in /home/pete/env/py2.7/lib/python2.7/site-packages (from resampy) (0.19.1)
Requirement already satisfied: six>=1.3 in /home/pete/env/py2.7/lib/python2.7/site-packages (from resampy) (1.11.0)
Requirement already satisfied: singledispatch; python_version < "3.4" in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (3.4.0.3)
Collecting llvmlite>=0.31.0dev0
  Using cached llvmlite-0.32.1.tar.gz (104 kB)
Requirement already satisfied: setuptools in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (44.1.1)
Requirement already satisfied: funcsigs; python_version < "3.3" in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (1.0.2)
Requirement already satisfied: enum34; python_version < "3.4" in /home/pete/env/py2.7/lib/python2.7/site-packages (from numba>=0.32->resampy) (1.1.10)
Building wheels for collected packages: llvmlite
  Building wheel for llvmlite (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/pete/env/py2.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-UP2Yh4/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-UP2Yh4/llvmlite/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-ZIPpvD
       cwd: /tmp/pip-install-UP2Yh4/llvmlite/
  Complete output (7 lines):
  running bdist_wheel
  /home/pete/env/py2.7/bin/python /tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py
    File "/tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py", line 122
      raise ValueError(msg.format(_ver_check_skip)) from e
                                                       ^
  SyntaxError: invalid syntax
  error: command '/home/pete/env/py2.7/bin/python' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build llvmlite
Installing collected packages: llvmlite, numba, resampy
    Running setup.py install for llvmlite ... error
    ERROR: Command errored out with exit status 1:
     command: /home/pete/env/py2.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-UP2Yh4/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-UP2Yh4/llvmlite/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-j9jtLs/install-record.txt --single-version-externally-managed --compile --install-headers /home/pete/env/py2.7/include/site/python2.7/llvmlite
         cwd: /tmp/pip-install-UP2Yh4/llvmlite/
    Complete output (10 lines):
    running install
    running build
    got version from file /tmp/pip-install-UP2Yh4/llvmlite/llvmlite/_version.py {'version': '0.32.1', 'full': 'aa11b129c0b55973067422397821ae6d44fa5e70'}
    running build_ext
    /home/pete/env/py2.7/bin/python /tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py
      File "/tmp/pip-install-UP2Yh4/llvmlite/ffi/build.py", line 122
        raise ValueError(msg.format(_ver_check_skip)) from e
                                                         ^
    SyntaxError: invalid syntax
    error: command '/home/pete/env/py2.7/bin/python' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/pete/env/py2.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-UP2Yh4/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-UP2Yh4/llvmlite/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-j9jtLs/install-record.txt --single-version-externally-managed --compile --install-headers /home/pete/env/py2.7/include/site/python2.7/llvmlite Check the logs for full command output.

我试过了pip3 install resampy,结果看起来更好:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: resampy in /usr/local/lib/python3.8/dist-packages (0.2.2)
Requirement already satisfied: numba>=0.32 in /usr/local/lib/python3.8/dist-packages (from resampy) (0.52.0)
Requirement already satisfied: scipy>=0.13 in /usr/local/lib/python3.8/dist-packages (from resampy) (1.6.0)
Requirement already satisfied: numpy>=1.10 in /home/pete/.local/lib/python3.8/site-packages (from resampy) (1.19.4)
Requirement already satisfied: six>=1.3 in /usr/lib/python3/dist-packages (from resampy) (1.14.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from numba>=0.32->resampy) (45.2.0)
Requirement already satisfied: llvmlite<0.36,>=0.35.0 in /usr/local/lib/python3.8/dist-packages (from numba>=0.32->resampy) (0.35.0)
WARNING: You are using pip version 20.3.3; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.

没有错误。但是当我尝试运行我尝试运行的程序时,我仍然得到原来的ImportError

我承认我在这里过头了。我基本上只有中等水平的 Python 知识/经验。我什至不知道“轮子”是什么,我在其中找不到任何东西,因为“轮子”很难在谷歌上找到有关轮胎等的东西。因此,即使只是了解“轮子”是什么的指针也会有所帮助。

谢谢!

4

2 回答 2

0

也许试试这个

pip install llvmlite==0.31.0

pip install resampy

就我而言,当前的llvmlite软件包版本使它崩溃了。但是这个包是需要的resampy

您也可以尝试resampy独立于llvmlite.

pip install resampy==0.1.5

祝你好运

于 2021-02-17T10:57:57.480 回答
0

我之前试过py27安装也失败了。

但是你可以通过 py38 安装它

pip install resampy

您可以通过以下方式对其进行测试

pip install -e .[tests]
pip install pytest pytest-cov pytest-faulthandler
py.test --cov-report term-missing --cov resampy

结果: 在此处输入图像描述

至于 ImportError,一旦您成功安装它,它对我来说效果很好: 在此处输入图像描述

于 2021-02-06T02:56:34.997 回答