centos环境python3.6下bpython的安装

centos环境python3.6下bpython的安装

注意:python3.6下通过python get-pip.py安装的pip可执行文件名为pip3

pip3 install bpython
......
Successfully installed blessings-1.6.1 bpython-0.17.1 certifi-2018.1.18 chardet-3.0.4 curtsies-0.3.0 greenlet-0.4.13 idna-2.6 pygments-2.2.0 requests-2.18.4 six-1.11.0 typing-3.6.4 urllib3-1.22 wcwidth-0.1.7

貌似安装成功,但是运行bpython报错:
ModuleNotFoundError: No module named '_curses'

解决办法:
1、 yum install ncurses-devel ncurses
(python3.6的Modules源码里面有_curses相关的源码,但Setup里面注释掉了,取消注释编译会报错,后采取yum安装的方式解决了该报错)
2、清理了之前的安装目录/usr/local/python3,重新安装
./configure --prefix=/usr/local/python3
make && make install

重新执行bpthon,报错:
ModuleNotFoundError: No module named 'encodings'

whereis bpython 找到bpython所在位置,修改第一行解释器为/usr/local/python3/bin/python3.6
(这里其实可以把bpython指向的解释器改掉,建一个软连接,参考后文)

重新执行bpython,报错如下:
ModuleNotFoundError: No module named 'bpython'

问题解决:
[root@huwy22 usr]# pip3 uninstall bpython
Could not find platform independent libraries
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f5d2a8fe7c0 (most recent call first):
Aborted (core dumped)
[root@huwy22 usr]# whereis pip3
pip3: /usr/local/bin/pip3.6 /usr/local/bin/pip3
[root@huwy22 usr]# vi /usr/local/bin/pip3
(这里我还去改了pip3的解释器,后来怕其他地方也用到/usr/local/bin/python3.6,所以直接把这个文件做了调整,如下)
[root@huwy22 usr]# cd /usr/local/bin/
[root@huwy22 bin]# mv python3.6 python3.6.bak
[root@huwy22 bin]# ln -s /usr/local/python3/bin/python3.6 python3.6
[root@huwy22 bin]# pip3 uninstall bpython
Cannot uninstall requirement bpython, not installed
[root@huwy22 bin]# pip3 install bpython
Collecting bpython
Using cached bpython-0.17.1-py2.py3-none-any.whl
Collecting pygments (from bpython)
Using cached Pygments-2.2.0-py2.py3-none-any.whl
Collecting requests (from bpython)
Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting six>=1.5 (from bpython)
Using cached six-1.11.0-py2.py3-none-any.whl
Collecting curtsies>=0.1.18 (from bpython)
Using cached curtsies-0.3.0.tar.gz
Collecting greenlet (from bpython)
Using cached greenlet-0.4.13-cp36-cp36m-manylinux1_x86_64.whl
Collecting idna<2.7,>=2.5 (from requests->bpython)
Using cached idna-2.6-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->bpython)
Using cached certifi-2018.1.18-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->bpython)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests->bpython)
Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting blessings>=1.5 (from curtsies>=0.1.18->bpython)
Using cached blessings-1.6.1-py3-none-any.whl
Collecting wcwidth>=0.1.4 (from curtsies>=0.1.18->bpython)
Using cached wcwidth-0.1.7-py2.py3-none-any.whl
Collecting typing (from curtsies>=0.1.18->bpython)
Using cached typing-3.6.4-py3-none-any.whl
Installing collected packages: pygments, idna, certifi, chardet, urllib3, requests, six, blessings, wcwidth, typing, curtsies, greenlet, bpython
Running setup.py install for curtsies ... done
Successfully installed blessings-1.6.1 bpython-0.17.1 certifi-2018.1.18 chardet-3.0.4 curtsies-0.3.0 greenlet-0.4.13 idna-2.6 pygments-2.2.0 requests-2.18.4 six-1.11.0 typing-3.6.4 urllib3-1.22 wcwidth-0.1.7
[root@huwy22 bin]# bpython
bpython version 0.17.1 on top of Python 3.6.5 /usr/local/python3/bin/python3.6
>>>

bpython官网: https://bpython-interpreter.org/downloads.html
正准备获取源码重新安装的,结果通过上面的调整,居然安装成功了,我也不知道该说啥了。
之前还笨笨的去一个一个安装依赖库:
依赖库
  • Pygments
yum install python34-pygments
  • requests
yum install python34-requests.noarch
  • curtsies >= 0.1.18

  • greenlet
yum install python-greenlet.x86_64 python-greenlet-devel.x86_64
  • six >= 1.5
yum install python34-six
  • Sphinx != 1.1.2 (可选, 用于制作文档)
  • mock (可选,用于测试)
  • babel (可选, 用于国际化)
  • watchdog (可选, 用于监测已经导入的模块是否有变动)
  • jedi (可选, 用于多行补全)


你可能感兴趣的:(Python,linux)