运行python时提示:ImportError: No module named plyvel ,ImportError No module named irc 解决过程:...

(当前python版本:2.7)

1.在git下载electrum-server:

cd /

git clone https://github.com/spesmilo/electrum-server.git

cd /electrum-server   #electrum-server可安装在任意路径下

  

在python2.7中输入命令:python run_electrum_server.py回车后,提示:

Traceback (most recent call last):
File "run_electrum_server.py", line 37, in <module>
imp.load_module('electrumserver', *imp.find_module('src'))
File "/root/electrum-server/src/__init__.py", line 2, in <module>
import storage
File "/root/electrum-server/src/storage.py", line 24, in <module>
import plyvel
ImportError: No module named plyvel

这个是由于缺少plyvel模块造成的。网上找了很多方法,已解决。

过程如下:

 

1.下载setuptools包并安装:

wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
tar -xzf setuptools-19.6.tar.gz && cd setuptools-19.6
python setup.py build
python setup.py install 

 

2.安装pip:
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
tar -xzf pip-8.0.2.tar.gz && cd pip-8.0.2
python setup.py build
python setup.py install
pip install --upgrade pip    #升级pip到新版

 

尝试运行electrum-server

cd /root/electrum-server && python run_electrum_server.py

报错:ImportError: No module named argparse,执行以下命令解决:

pip install argparse

 

3.通过pip安装plyvel(目前是1.0.4版)
pip install plyvel

 

再次执行:python run_electrum_server.py

回车后又报错了:缺少irc模块

ImportError No module named irc

继续解决:

4.下载irc模块

cd /usr/local/src

wget https://jaist.dl.sourceforge.net/project/python-irclib/irc-2.0.4.zip

unzip irc-2.0.4.zip

cd irc-2.0.4

unzip paver-minilib.zip

python setup.py install

假如安装irc时报错,提示找不到paver-minilib.zip,则在setup.py文件中将该zip文件名加上全路径即可安装成功:

vim setup.py

try:
import paver.tasks
except ImportError:
from os.path import exists
if exists("/usr/local/src/irc-2.0.4/paver-minilib.zip"):
import sys
sys.path.insert(0, "/usr/local/src/irc-2.0.4/paver-minilib.zip")

保存退出

python setup.py install

cd /electrum-server/

cp electrum.conf.sample electrum.conf

 

electrum要运行在非root用户:

useradd run_electrum && echo "12345678" | passwd --stdin run_electrum   #用户名任意

chown -R run_electrum. /electrum-server

su - run_electrum

cd /electrum-server

python run_electrum_server.py &     #正式运行electrum-server

搞定。

 

 

附:

cat electrum.conf

[server]
# username for running the daemon
username = root
# hostname. set it to a FQDN in order to be reached from outside
host = 0.0.0.0
# ports
electrum_rpc_port = 8000
stratum_tcp_port = 50001
#stratum_tcp_ssl_port = 50002
#report_host =
#report_stratum_tcp_port = 50001
#report_stratum_tcp_ssl_port = 50002
banner = Welcome to Electrum!
banner_file = /etc/electrum.banner
#irc = no
#irc_nick = <yournickname>
#irc_bind_ip = <external ip address>
#ssl_certfile = /path/to/electrum-server.crt
#ssl_keyfile = /path/to/electrum-server.key
logfile = ./electrum.log
donation_address =

 

[leveldb]
# path to your database
path = ./path001
# for each address, history will be pruned if it is longer than this limit
pruning_limit = 100

 

# cache sizes in bytes, the default is optimized for ~4 GB RAM setups to run bitcoind alongside
# If you have lots of RAM increase up to 16 times for best performance
#hist_cache = 67108864
#utxo_cache = 134217728
#addr_cache = 16777216

 

## Bitcoin network parameters
[network]
# Change type to bitcoin_test to enable testnet
type = bitcoin_main
# Advanced, manually change the network parameters
pubkey_address = 65
script_address = 5
genesis_hash = 000000002eadfb5640e8ad074e83acf1f2addccacbdb32fac8f0b08005c6f860

[bitcoind]
bitcoind_host = localhost
bitcoind_port = 8292
bitcoind_user = user
bitcoind_password =123456

 

转载于:https://www.cnblogs.com/hy007x/p/7462690.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值