pip 安装其他工具报错处理

今天在linux 上用下python 写东西,在python解释器中用回退键和上下左右键的时候报错。。。

然后想到readline插件,于是用pip install readline安装插件,结果报错了,信息如下:

[root@localhost ~]# pip install readline
Collecting readline
  Using cached readline-6.2.4.1.tar.gz
Installing collected packages: readline
  Running setup.py install for readline ... error
    Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yaN9Fr/readline/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-LArwHg-record/install-record.txt --single-version-externally-managed --compile:
    
    ============ Building the readline library ============
    
    readline-6.2/
    readline-6.2/doc/
    readline-6.2/doc/Makefile.in
    readline-6.2/doc/texinfo.tex
    readline-6.2/doc/version.texi
    readline-6.2/doc/fdl.texi
    readline-6.2/doc/rlman.texi
    readline-6.2/doc/rltech.texi
    readline-6.2/doc/rluser.texi
    readline-6.2/doc/rluserman.texi
    readline-6.2/doc/history.texi
    readline-6.2/doc/hstech.texi
    readline-6.2/doc/hsuser.texi
    readline-6.2/doc/readline.3
    readline-6.2/doc/history.3
    readline-6.2/doc/texi2dvi
    readline-6.2/doc/texi2html
    readline-6.2/doc/readline.ps
    readline-6.2/doc/history.ps
    readline-6.2/doc/rluserman.ps
    readline-6.2/doc/readline.dvi
    readline-6.2/doc/history.dvi
    readline-6.2/doc/rluserman.dvi
    readline-6.2/doc/readline.info
    readline-6.2/doc/history.info
    readline-6.2/doc/rluserman.info
    readline-6.2/doc/readline.html
    readline-6.2/doc/history.html
    readline-6.2/doc/rluserman.html
    readline-6.2/doc/readline.0
    readline-6.2/doc/history.0
    readline-6.2/doc/readline_3.ps
    readline-6.2/doc/history_3.ps
    readline-6.2/doc/history.pdf
    readline-6.2/doc/readline.pdf
    readline-6.2/doc/rluserman.pdf
    readline-6.2/examples/
    readline-6.2/examples/autoconf/
    readline-6.2/examples/autoconf/BASH_CHECK_LIB_TERMCAP
    readline-6.2/examples/autoconf/RL_LIB_READLINE_VERSION
    readline-6.2/examples/autoconf/wi_LIB_READLINE
    readline-6.2/examples/rlfe/
    readline-6.2/examples/rlfe/ChangeLog
    readline-6.2/examples/rlfe/Makefile.in
    readline-6.2/examples/rlfe/README
    readline-6.2/examples/rlfe/config.h.in
    readline-6.2/examples/rlfe/configure
    readline-6.2/examples/rlfe/configure.in
    readline-6.2/examples/rlfe/extern.h
    readline-6.2/examples/rlfe/os.h
    readline-6.2/examples/rlfe/pty.c
    readline-6.2/examples/rlfe/rlfe.c
    readline-6.2/examples/rlfe/screen.h
    readline-6.2/examples/Makefile.in
    readline-6.2/examples/excallback.c
    readline-6.2/examples/fileman.c
    readline-6.2/examples/manexamp.c
    readline-6.2/examples/readlinebuf.h
    readline-6.2/examples/rl-fgets.c
    readline-6.2/examples/rlcat.c
    readline-6.2/examples/rlevent.c
    readline-6.2/examples/rltest.c
    readline-6.2/examples/rl.c
    readline-6.2/examples/rlptytest.c
    readline-6.2/examples/rlversion.c
    readline-6.2/examples/histexamp.c
    readline-6.2/examples/Inputrc
    readline-6.2/examples/rlwrap-0.30.tar.gz
    readline-6.2/support/
    readline-6.2/support/config.guess
    readline-6.2/support/config.rpath
    readline-6.2/support/config.sub
    readline-6.2/support/install.sh
    readline-6.2/support/mkdirs
    readline-6.2/support/mkdist
    readline-6.2/support/mkinstalldirs
    readline-6.2/support/shobj-conf
    readline-6.2/support/shlib-install
    readline-6.2/support/wcwidth.c
    readline-6.2/shlib/
    readline-6.2/shlib/Makefile.in
    readline-6.2/COPYING
    readline-6.2/README
    readline-6.2/MANIFEST
    readline-6.2/INSTALL
    readline-6.2/CHANGELOG
    readline-6.2/CHANGES
    readline-6.2/NEWS
    readline-6.2/USAGE
    readline-6.2/aclocal.m4
    readline-6.2/config.h.in
    readline-6.2/configure
    readline-6.2/configure.in
    readline-6.2/Makefile.in
    readline-6.2/ansi_stdlib.h
    readline-6.2/chardefs.h
    readline-6.2/history.h
    readline-6.2/histlib.h
    readline-6.2/keymaps.h
    readline-6.2/posixdir.h
    readline-6.2/posixjmp.h
    readline-6.2/readline.h
    readline-6.2/posixselect.h
    readline-6.2/posixstat.h
    readline-6.2/rlconf.h
    readline-6.2/rldefs.h
    readline-6.2/rlmbutil.h
    readline-6.2/rlprivate.h
    readline-6.2/rlshell.h
    readline-6.2/rlstdc.h
    readline-6.2/rltty.h
    readline-6.2/rltypedefs.h
    readline-6.2/rlwinsize.h
    readline-6.2/tcap.h
    readline-6.2/tilde.h
    readline-6.2/xmalloc.h
    readline-6.2/bind.c
    readline-6.2/callback.c
    readline-6.2/compat.c
    readline-6.2/complete.c
    readline-6.2/display.c
    readline-6.2/emacs_keymap.c
    readline-6.2/funmap.c
    readline-6.2/input.c
    readline-6.2/isearch.c
    readline-6.2/keymaps.c
    readline-6.2/kill.c
    readline-6.2/macro.c
    readline-6.2/mbutil.c
    readline-6.2/misc.c
    readline-6.2/nls.c
    readline-6.2/parens.c
    readline-6.2/readline.c
    readline-6.2/rltty.c
    readline-6.2/savestring.c
    readline-6.2/search.c
    readline-6.2/shell.c
    readline-6.2/signals.c
    readline-6.2/terminal.c
    readline-6.2/text.c
    readline-6.2/tilde.c
    readline-6.2/undo.c
    readline-6.2/util.c
    readline-6.2/vi_keymap.c
    readline-6.2/vi_mode.c
    readline-6.2/xfree.c
    readline-6.2/xmalloc.c
    readline-6.2/history.c
    readline-6.2/histexpand.c
    readline-6.2/histfile.c
    readline-6.2/histsearch.c
    readline-6.2/patchlevel
    ./build.sh: line 41: patch: command not found
    
    ============ Building the readline extension module ============
    
    running install
    running build
    running build_ext
    building 'readline' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/Modules
    creating build/temp.linux-x86_64-2.7/Modules/2.x
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/usr/local/include/python2.7 -c Modules/2.x/readline.c -o build/temp.linux-x86_64-2.7/Modules/2.x/readline.o -Wno-strict-prototypes
    creating build/lib.linux-x86_64-2.7
    gcc -pthread -shared build/temp.linux-x86_64-2.7/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -lncurses -o build/lib.linux-x86_64-2.7/readline.so
    gcc: readline/libreadline.a: No such file or directory
    gcc: readline/libhistory.a: No such file or directory
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yaN9Fr/readline/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-LArwHg-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-yaN9Fr/readline/

 

然后

#yum -y install patch

安装了这个打补丁工具

再用

[root@localhost ~]# pip install readline
Collecting readline
  Using cached readline-6.2.4.1.tar.gz
Installing collected packages: readline
  Running setup.py install for readline ... done
Successfully installed readline-6.2.4.1

OK成功了。。。现在就可以放心的使用上下左右及回退键了。

转载于:https://my.oschina.net/54720/blog/673265

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当在PyCharm中使用pip时遇到"SyntaxError: invalid syntax"报错,可能是因为pip命令被误认为是Python代码而导致的。解决这个问题的方法有几种: 1. 确保你使用的是正确的命令行界面。在PyCharm中,你可以选择使用PyCharm的内置终端或者使用系统自带的命令行工具。确保你在正确的环境中运行pip命令。 2. 确保你在正确的位置运行pip命令。在PyCharm中,默认情况下,终端会打开在你的项目根目录。如果你希望在特定的虚拟环境中安装包,你需要在终端中切换到那个环境。 3. 如果以上方法都无效,你可以尝试使用Python的全局路径来运行pip。在PyCharm的终端中,使用完整的Python可执行文件路径来运行pip命令。例如,对于Windows系统,可以尝试在终端中执行`C:\Python37\Scripts\pip install package`(假设你的Python可执行文件路径是C:\Python37)。 4. 另一种方法是通过PyCharm的包管理器来安装包。在PyCharm中,你可以打开项目设置,然后选择"Project Interpreter"选项卡。在这里,你可以添加、删除和管理你的Python包。通过这种方式安装包,PyCharm会自动处理pip命令,避免了语法错误。 总结起来,如果在PyCharm中使用pip时遇到"SyntaxError: invalid syntax"报错,你可以确保你在正确的命令行界面中运行pip命令,确保你在正确的位置运行pip命令,或者尝试使用Python的全局路径来运行pip。另外,你还可以通过PyCharm的包管理器来安装包。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值