我正在按照本教程中的说明尝试$ sudo pip3 install iconservice
:
https://medium.com/@2infiniti/creating-icon-dapp-from-a-z-part-1-tools-environment-dd56f8dfc905。
我正在运行OS-X。
我收到以下错误消息,我不确定发生了什么。我已经按照其他地方的指示弄乱了cflags,但是没有任何变化。
35 warnings and 4 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Moving to /usr/local/lib/python3.7/site-packages/plyvel-1.1.0.dist-info/
from /usr/local/lib/python3.7/site-packages/~lyvel-1.1.0.dist-info
Moving to /usr/local/lib/python3.7/site-packages/plyvel/
from /usr/local/lib/python3.7/site-packages/~lyvel
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-nsgaksl0/plyvel/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-rhqla4_4/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-nsgaksl0/plyvel/~
答案 0 :(得分:3)
似乎iconservice
软件包requires libsecp256k
已安装在您的系统上。
Building wheel for secp256k1 (setup.py) ... error
ERROR: ...
ERROR: 0.29.1
Using bundled libsecp256k1
...
Failed to build secp256k1
对于Linux,只需按照Setup on Linux步骤首先安装即可:
$ sudo apt-get install libleveldb1 libleveldb-dev libsecp256k1-dev
$ pip install iconservice
对于Mac OS X,它需要执行更多步骤:
# install leveldb
$ brew install pkg-config automake libtool leveldb
# install libsecp256k (from source)
# based on this (https://github.com/bitcoin-core/secp256k1#build-steps)
$ git clone https://github.com/bitcoin-core/secp256k1.git
$ cd secp256k1/
$ ./autogen.sh
$ ./configure
$ make
# install plyvel
# based on this (https://github.com/wbolster/plyvel/issues/66#issuecomment-460094085)
$ mv /Applications/XCode.app /Applications/Xcode_cp.app
$ leveldb_version=$(ls /usr/local/Cellar/leveldb/ | tail -1)
$ CFLAGS="-mmacosx-version-min=10.7 -stdlib=libc++" \
pip install plyvel \
--no-cache-dir \
--global-option=build_ext \
--global-option="-I/usr/local/Cellar/leveldb/${leveldb_version}/include/" \
--global-option="-L/usr/local/lib"
$ mv /Applications/XCode_cp.app /Applications/Xcode.app
$ pip freeze | grep plyvel
plyvel==1.1.0
# download icon-service source
$ git clone https://github.com/icon-project/icon-service.git
# edit the requirements.txt included with the icon-service source
# to update the plyvel version to match what's already installed
# on your machine (from the previous step)
$ cd icon-service
$ vim requirements.txt
$ cat requirements.txt
...
plyvel==1.1.0 <-- I updated this from 1.0.5
...
# build and install iconservice from wheels
$ ./build.sh
$ CFLAGS="-mmacosx-version-min=10.7 -stdlib=libc++" \
pip install dist/iconservice-1.3.0-py3-none-any.whl \
--no-cache-dir \
--global-option=build_ext \
--global-option="-I/usr/local/Cellar/leveldb/${leveldb_version}/include/" \
--global-option="-L/usr/local/lib"
请注意,我从源代码安装了iconservice
,因为pip install iconservice
仍然失败(我认为该轮子不适用于Mac OS X)。然后,我还从plyvel
源文件中的 requirements.txt 文件中更新了iconservice
版本,因为从车轮上安装它需要1.0.5版本,但是我已经有了plyvel为1.1.0(我不知道这是否会对软件包的行为产生影响。)。
另一方面,如果您已经在使用虚拟环境,那么您不应该再将sudo
与pip install
一起使用。使用virtualenv的目的是避免“弄脏”系统软件包,如果您使用sudo
,则有悖于virtualenv的目的。