运行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

运行python时提示:ImportError: No module named plyvel  ,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

搞定。

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

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

附:

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

上一篇:[转]精选!15个必备的VSCode插件


下一篇:新浪云git 上传 nodejs项目