如何正确安装pypesq?

问题描述 投票:0回答:2

我已经尝试使用

pip
安装
pypesq
。我在尝试的任何操作系统中都收到以下错误。我尝试了 Windows 11、Windows 10、WSL2 和 Ubuntu 22.04,但仍然遇到同样的情况。我尝试更新
pip
,但仍然出现此错误。我该怎么做才能正确安装
pypesq
我已经在 github 上留下了关于此问题的问题
pypesq
,但两周后我还没有得到回复。

username@username_home:~$ pip install pypesq
Collecting pypesq
  Using cached pypesq-1.2.4.tar.gz (30 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./anaconda3/lib/python3.9/site-packages (from pypesq) (1.21.5)
Building wheels for collected packages: pypesq
  Building wheel for pypesq (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [88 lines of output]
      running bdist_wheel
      running build
      running build_py
      file numpy.py (for module numpy) not found
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/pypesq
      copying pypesq/__init__.py -> build/lib.linux-x86_64-cpython-39/pypesq
      file numpy.py (for module numpy) not found
      running build_ext
      building 'pesq_core' extension
      creating build/temp.linux-x86_64-cpython-39
      creating build/temp.linux-x86_64-cpython-39/pypesq
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/dsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/dsp.o
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesq.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o
      In file included from /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1969,
                       from /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                       from /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from pypesq/pesq.c:2:
      /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
         17 | #warning "Using deprecated NumPy API, disable it with " \
            |  ^~~~~~~
      pypesq/pesq.c: In function ‘_pesq’:
      pypesq/pesq.c:61:34: warning: passing argument 1 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
         61 |     float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
            |                               ~~~^~~~~~
            |                                  |
            |                                  char *
      In file included from pypesq/pesq.c:5:
      pypesq/pesq.h:287:28: note: expected ‘short int *’ but argument is of type ‘char *’
        287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
            |                    ~~~~~~~~^~~
      pypesq/pesq.c:61:45: warning: passing argument 2 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
         61 |     float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
            |                                          ~~~^~~~~~
            |                                             |
            |                                             char *
      In file included from pypesq/pesq.c:5:
      pypesq/pesq.h:287:41: note: expected ‘short int *’ but argument is of type ‘char *’
        287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
            |                                 ~~~~~~~~^~~
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqdsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqio.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o
      pypesq/pesqio.c: In function ‘load_src’:
      pypesq/pesqio.c:200:10: warning: unused variable ‘s’ [-Wunused-variable]
        200 |     char s;
            |          ^
      pypesq/pesqio.c:198:10: warning: unused variable ‘count’ [-Wunused-variable]
        198 |     long count;
            |          ^~~~~
      pypesq/pesqio.c:196:10: warning: unused variable ‘to_read’ [-Wunused-variable]
        196 |     long to_read;
            |          ^~~~~~~
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmain.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o
      pypesq/pesqmain.c: In function ‘compute_pesq’:
      pypesq/pesqmain.c:118:10: warning: unused variable ‘names’ [-Wunused-variable]
        118 |     int  names = 0;
            |          ^~~~~
      pypesq/pesqmain.c: In function ‘pesq_measure’:
      pypesq/pesqmain.c:405:25: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
        405 |             long start, end;
            |                         ^~~
      pypesq/pesqmain.c:405:18: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
        405 |             long start, end;
            |                  ^~~~~
      pypesq/pesqmain.c:242:9: warning: unused variable ‘i’ [-Wunused-variable]
        242 |     int i;
            |         ^
      pypesq/pesqmain.c:404:12: warning: ‘resultsFile’ may be used uninitialized [-Wmaybe-uninitialized]
        404 |         if (resultsFile != NULL) {
            |            ^
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmod.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o
      pypesq/pesqmod.c: In function ‘utterance_split’:
      pypesq/pesqmod.c:298:10: warning: variable ‘Utt_Delay’ set but not used [-Wunused-but-set-variable]
        298 |     long Utt_Delay;
            |          ^~~~~~~~~
      pypesq/pesqmod.c: In function ‘pesq_psychoacoustic_model’:
      pypesq/pesqmod.c:806:13: warning: variable ‘peak’ set but not used [-Wunused-but-set-variable]
        806 |     float   peak;
            |             ^~~~
      pypesq/pesqmod.c:782:24: warning: variable ‘power_deg’ set but not used [-Wunused-but-set-variable]
        782 |     float   power_ref, power_deg;
            |                        ^~~~~~~~~
      pypesq/pesqmod.c:782:13: warning: variable ‘power_ref’ set but not used [-Wunused-but-set-variable]
        782 |     float   power_ref, power_deg;
            |             ^~~~~~~~~
      g++ -pthread -B /home/username/anaconda3/compiler_compat -shared -Wl,-rpath,/home/username/anaconda3/lib -Wl,-rpath-link,/home/username/anaconda3/lib -L/home/username/anaconda3/lib -L/home/username/anaconda3/lib -Wl,-rpath,/home/username/anaconda3/lib -Wl,-rpath-link,/home/username/anaconda3/lib -L/home/username/anaconda3/lib build/temp.linux-x86_64-cpython-39/pypesq/dsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o -o build/lib.linux-x86_64-cpython-39/pesq_core.cpython-39-x86_64-linux-gnu.so
      error: command 'g++' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pypesq
  Running setup.py clean for pypesq
Failed to build pypesq
Installing collected packages: pypesq
  Running setup.py install for pypesq ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pypesq did not run successfully.
  │ exit code: 1
  ╰─> [90 lines of output]
      running install
      /home/username/anaconda3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      file numpy.py (for module numpy) not found
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/pypesq
      copying pypesq/__init__.py -> build/lib.linux-x86_64-cpython-39/pypesq
      file numpy.py (for module numpy) not found
      running build_ext
      building 'pesq_core' extension
      creating build/temp.linux-x86_64-cpython-39
      creating build/temp.linux-x86_64-cpython-39/pypesq
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/dsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/dsp.o
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesq.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o
      In file included from /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1969,
                       from /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                       from /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from pypesq/pesq.c:2:
      /home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
         17 | #warning "Using deprecated NumPy API, disable it with " \
            |  ^~~~~~~
      pypesq/pesq.c: In function ‘_pesq’:
      pypesq/pesq.c:61:34: warning: passing argument 1 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
         61 |     float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
            |                               ~~~^~~~~~
            |                                  |
            |                                  char *
      In file included from pypesq/pesq.c:5:
      pypesq/pesq.h:287:28: note: expected ‘short int *’ but argument is of type ‘char *’
        287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
            |                    ~~~~~~~~^~~
      pypesq/pesq.c:61:45: warning: passing argument 2 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
         61 |     float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
            |                                          ~~~^~~~~~
            |                                             |
            |                                             char *
      In file included from pypesq/pesq.c:5:
      pypesq/pesq.h:287:41: note: expected ‘short int *’ but argument is of type ‘char *’
        287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
            |                                 ~~~~~~~~^~~
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqdsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqio.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o
      pypesq/pesqio.c: In function ‘load_src’:
      pypesq/pesqio.c:200:10: warning: unused variable ‘s’ [-Wunused-variable]
        200 |     char s;
            |          ^
      pypesq/pesqio.c:198:10: warning: unused variable ‘count’ [-Wunused-variable]
        198 |     long count;
            |          ^~~~~
      pypesq/pesqio.c:196:10: warning: unused variable ‘to_read’ [-Wunused-variable]
        196 |     long to_read;
            |          ^~~~~~~
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmain.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o
      pypesq/pesqmain.c: In function ‘compute_pesq’:
      pypesq/pesqmain.c:118:10: warning: unused variable ‘names’ [-Wunused-variable]
        118 |     int  names = 0;
            |          ^~~~~
      pypesq/pesqmain.c: In function ‘pesq_measure’:
      pypesq/pesqmain.c:405:25: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
        405 |             long start, end;
            |                         ^~~
      pypesq/pesqmain.c:405:18: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
        405 |             long start, end;
            |                  ^~~~~
      pypesq/pesqmain.c:242:9: warning: unused variable ‘i’ [-Wunused-variable]
        242 |     int i;
            |         ^
      pypesq/pesqmain.c:404:12: warning: ‘resultsFile’ may be used uninitialized [-Wmaybe-uninitialized]
        404 |         if (resultsFile != NULL) {
            |            ^
      gcc -pthread -B /home/username/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/include -I/home/username/anaconda3/include -fPIC -O2 -isystem /home/username/anaconda3/include -fPIC -Ipypesq -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/include/python3.9 -I/home/username/anaconda3/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmod.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o
      pypesq/pesqmod.c: In function ‘utterance_split’:
      pypesq/pesqmod.c:298:10: warning: variable ‘Utt_Delay’ set but not used [-Wunused-but-set-variable]
        298 |     long Utt_Delay;
            |          ^~~~~~~~~
      pypesq/pesqmod.c: In function ‘pesq_psychoacoustic_model’:
      pypesq/pesqmod.c:806:13: warning: variable ‘peak’ set but not used [-Wunused-but-set-variable]
        806 |     float   peak;
            |             ^~~~
      pypesq/pesqmod.c:782:24: warning: variable ‘power_deg’ set but not used [-Wunused-but-set-variable]
        782 |     float   power_ref, power_deg;
            |                        ^~~~~~~~~
      pypesq/pesqmod.c:782:13: warning: variable ‘power_ref’ set but not used [-Wunused-but-set-variable]
        782 |     float   power_ref, power_deg;
            |             ^~~~~~~~~
      g++ -pthread -B /home/username/anaconda3/compiler_compat -shared -Wl,-rpath,/home/username/anaconda3/lib -Wl,-rpath-link,/home/username/anaconda3/lib -L/home/username/anaconda3/lib -L/home/username/anaconda3/lib -Wl,-rpath,/home/username/anaconda3/lib -Wl,-rpath-link,/home/username/anaconda3/lib -L/home/username/anaconda3/lib build/temp.linux-x86_64-cpython-39/pypesq/dsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o -o build/lib.linux-x86_64-cpython-39/pesq_core.cpython-39-x86_64-linux-gnu.so
      error: command 'g++' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pypesq

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
python installation pip command conda
2个回答
0
投票

错误读取

错误:命令“g++”失败:没有这样的文件或目录

在 Ubuntu 上,您需要像这样安装

g++

sudo apt-get update
sudo apt-get install g++

0
投票

我用

pip install https://github.com/vBaiCai/python-pesq/archive/master.zip 

它解决了问题

© www.soinside.com 2019 - 2024. All rights reserved.