【问题标题】:Can't install spams on python 2.7 (Os: Fedora)无法在 python 2.7 上安装垃圾邮件(操作系统:Fedora)
【发布时间】:2021-04-15 18:38:30
【问题描述】:

我尝试使用画中画命令安装垃圾邮件,但出现此错误:

 Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-zI4__D/spams/setup.py", line 121, in <module>
    with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function

所以,我下载了垃圾邮件的压缩文件,并修改了 setup.py 文件以防止编码关键字问题,当我安装库时出现此错误:

    warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^
/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -llapack
collect2: error: ld returned 1 exit status
error: Command "g++ -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/spams_wrap/spams_wrap.o -L/usr/local/lib64 -L/usr/local/lib -L/usr/lib64 -L/usr/lib -L/usr/lib/ -L/usr/lib64 -lstdc++ -lblas -llapack -lpython2.7 -o build/lib.linux-x86_64-2.7/_spams_wrap.so -fopenmp" failed with exit status 1

当我尝试“pip install spams==2.6.1”时,我收到此错误:

    error: Command "gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_           FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4            -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG            -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong            --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOUR           CE -fPIC -fwrapv -fPIC -I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/di           ctLearn -I/home/aabdelli/.local/lib/python2.7/site-packages/numpy/core/include -           I/usr/include/python2.7 -I/usr/local/include -I/usr/include -I/usr/include/pytho           n2.7 -c spams_wrap.cpp -o build/temp.linux-x86_64-2.7/spams_wrap.o -DNDEBUG -DUS           E_BLAS_LIB -std=c++11 -fPIC -fopenmp -Wunused-variable -m64" failed with exit st           atus 1

    ----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-           build-8cd3Ds/spams/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file           __).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-           OH2Naf-record/install-record.txt --single-version-externally-managed --compile -           -user --prefix=" failed with error code 1 in /tmp/pip-build-8cd3Ds/spams/

【问题讨论】:

  • 不再支持 Python 2.7。编码是一种非常python-3的东西。考虑切换到 python 3。
  • 支持什么的,没看懂!!我无法切换到 python3,因为它不是我的机器。对于编码问题,我修复了它
  • Python 开发者不再支持它:python.org/doc/sunset-python-2。 Numpy 也有一段时间不支持 python 2。设置#define 警告告诉你要绕过。我怀疑你必须做更多的事情才能让它工作。

标签: python linux pip pyinstaller


【解决方案1】:

第一次升级pip:

pip install -U pip setuptools

SPAMS' setup.py imports numpy 在安装之前,所以首先你必须安装numpy:

pip install numpy

垃圾邮件需要 BLAS 和 LAPACK。您需要安装 Fedora 的库。见https://fedoraproject.org/wiki/PackagingDrafts/BLAS_LAPACK。试试

yum install openblas lapack

然后使用垃圾邮件:

pip install spams==2.6.1

【讨论】:

  • 也不安装
  • 编辑您的问题并显示错误文本。
  • 我进行了更多调查并重写了答案。
猜你喜欢
  • 2011-06-17
  • 2015-05-28
  • 2017-06-15
  • 1970-01-01
  • 2011-01-10
  • 2011-09-18
  • 2011-04-03
  • 1970-01-01
  • 2017-11-06
相关资源
最近更新 更多