3

当我尝试将锯齿 SDK 导入 Pycharm 时失败并出现以下错误

Collecting sawtooth-sdk==1.0.1
Using cached sawtooth-sdk-1.0.1.tar.gz
Requirement already satisfied: colorlog in /home/user/PycharmProjects/test/venv/lib/python3.6/site-packages (from sawtooth-sdk==1.0.1)
Collecting sawtooth-signing (from sawtooth-sdk==1.0.1)
  Using cached sawtooth-signing-1.0.1.tar.gz
Collecting protobuf (from sawtooth-sdk==1.0.1)
  Using cached protobuf-3.5.2.post1-cp36-cp36m-manylinux1_x86_64.whl
Collecting pyzmq (from sawtooth-sdk==1.0.1)
  Using cached pyzmq-17.0.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting toml (from sawtooth-sdk==1.0.1)
  Using cached toml-0.9.4.tar.gz
Collecting PyYAML (from sawtooth-sdk==1.0.1)
  Using cached PyYAML-3.12.tar.gz
Collecting secp256k1 (from sawtooth-signing->sawtooth-sdk==1.0.1)
  Using cached secp256k1-0.13.2.tar.gz
Collecting six>=1.9 (from protobuf->sawtooth-sdk==1.0.1)
  Using cached six-1.11.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /home/user/PycharmProjects/test/venv/lib/python3.6/site-packages (from protobuf->sawtooth-sdk==1.0.1)
Requirement already satisfied: cffi>=1.3.0 in /home/user/PycharmProjects/test/venv/lib/python3.6/site-packages (from secp256k1->sawtooth-signing->sawtooth-sdk==1.0.1)
Requirement already satisfied: pycparser in /home/user/PycharmProjects/test/venv/lib/python3.6/site-packages (from cffi>=1.3.0->secp256k1->sawtooth-signing->sawtooth-sdk==1.0.1)
Installing collected packages: secp256k1, sawtooth-signing, six, protobuf, pyzmq, toml, PyYAML, sawtooth-sdk
  Running setup.py install for secp256k1: started
    Running setup.py install for secp256k1: finished with status 'error'
    Complete output from command /home/user/PycharmProjects/test/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pycharm-packaging/secp256k1/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-g3n5renb-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/PycharmProjects/test/venv/include/site/python3.6/secp256k1:
    0.29.1
    Installed libsecp256k1 is unusable falling back to bundled version.
    Using bundled libsecp256k1
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/secp256k1
    copying secp256k1/__init__.py -> build/lib.linux-x86_64-3.6/secp256k1
    copying secp256k1/__main__.py -> build/lib.linux-x86_64-3.6/secp256k1
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    generating cffi module 'build/temp.linux-x86_64-3.6/_libsecp256k1.c'
    creating build/temp.linux-x86_64-3.6
    building '_libsecp256k1' extension
    creating build/temp.linux-x86_64-3.6/build
    creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/user/PycharmProjects/test/venv/include -I/usr/include/python3.6m -c build/temp.linux-x86_64-3.6/_libsecp256k1.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_libsecp256k1.o
    build/temp.linux-x86_64-3.6/_libsecp256k1.c:22:24: fatal error: pyconfig.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

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

Command "/home/user/PycharmProjects/test/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pycharm-packaging/secp256k1/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-g3n5renb-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/PycharmProjects/test/venv/include/site/python3.6/secp256k1" failed with error code 1 in /tmp/pycharm-packaging/secp256k1/

当我运行 pip 命令pip install sawtooth-sdk==1.0.1时它会成功,但是它将文件安装到 python 2.7 版本,我需要为 python 3.6 安装它,它是我用于这个项目的解释器。或者无论如何将它们从sawtooth项目提供的sdk文件夹中直接导入pycharm?有什么帮助吗??

4

3 回答 3

2

使用可用于的 pip3Ubuntu-16.04

sudo apt-get install python3-pip
sudo pip3 install sawtooth-sdk==1.0.1
于 2018-03-29T08:08:11.323 回答
1

无法更改 Python 版本的另一种解决方案:secp256k1在系统中安装库。例如,要将其安装在python3.7docker 映像上:

RUN apt update && apt install -y libsecp256k1-dev libsecp256k1-0
于 2019-09-04T08:58:46.630 回答
0

我将python解释器更改为3.5版并正确安装

于 2018-03-29T08:44:20.450 回答