小编hsf*_*xjy的帖子

安装readline模块后,Python 3.6.1崩溃了

我刚从源代码安装了Python 3.6.1,然后运行sudo pip3 install readline安装readline模块.但是当我启动Python shell时,无论我输入什么,它都会崩溃:

Python 3.6.1 (default, Mar 25 2017, 13:40:56) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello")
*** Error in `python3': munmap_chunk(): invalid pointer: 0x00007fa3c64960a0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fa3c565e7e5]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x1a8)[0x7fa3c566aae8]
python3(PyOS_Readline+0xec)[0x5c3bcc]
python3[0x447cd0]
python3[0x449788]
python3(PyTokenizer_Get+0x9)[0x44a659]
python3[0x44617e]
python3(PyParser_ASTFromFileObject+0xa3)[0x428803]
python3(PyRun_InteractiveOneObject+0x122)[0x428a42]
python3(PyRun_InteractiveLoopFlags+0x6e)[0x428dce]
python3(PyRun_AnyFileExFlags+0x3c)[0x428efc]
python3(Py_Main+0xe4f)[0x43ba3f]
python3(main+0x162)[0x41dc52]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fa3c5607830]
python3(_start+0x29)[0x41dd29]
======= Memory map: ========
00400000-00663000 r-xp 00000000 08:05 16779642                           /usr/local/bin/python3.6
00862000-00863000 r--p 00262000 08:05 16779642                           /usr/local/bin/python3.6
00863000-008c7000 rw-p 00263000 08:05 …
Run Code Online (Sandbox Code Playgroud)

python readline python-3.6

21
推荐指数
1
解决办法
2224
查看次数

如何解释在信号处理程序中打印导致的重入运行时错误?

码:

# callee.py
import signal
import sys
import time


def int_handler(*args):
    for i in range(10):
        print('INTERRUPT', args)
    sys.exit()


if __name__ == '__main__':

    signal.signal(signal.SIGINT, int_handler)
    signal.signal(signal.SIGTERM, int_handler)
    while 1:
        time.sleep(1)
Run Code Online (Sandbox Code Playgroud)
# caller.py
import subprocess
import sys


def wait_and_communicate(p):
    out, err = p.communicate(timeout=1)
    print('========out==========')
    print(out.decode() if out else '')
    print('========err==========')
    print(err.decode() if err else '')
    print('=====================')


if __name__ == '__main__':

    p = subprocess.Popen(
        ['/usr/local/bin/python3', 'callee.py'],
        stdout=sys.stdout,
        stderr=subprocess.PIPE,
    )
    while 1:
        try:
            wait_and_communicate(p)
        except KeyboardInterrupt:
            p.terminate()
            wait_and_communicate(p)
            break
        except subprocess.TimeoutExpired:
            continue
Run Code Online (Sandbox Code Playgroud)

只需执行caller.py …

python signals reentrancy race-condition python-3.x

16
推荐指数
1
解决办法
1359
查看次数

如何使用apt-get删除不完整的包?

我试图在Ubuntu中通过apt-get安装android-studio,并发现需要从Google下载大小为233 M的依赖包.由于我在中国,网络状况非常糟糕,我无法完全下载软件包,最后我不得不放弃.
然而,这里出现了一个问题:现在每次执行时apt-get我都会得到一些提示Incomplete dependency并被要求下载上面的包.如果我执行sudo apt-get remove android-studio错误将发生:

dpkg: error processing package android-studio (--remove):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
An error occurred when processing:
android-studio
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

apt-get被困住了.那我怎么能完全删除一个不完整的包呢?

linux ubuntu apt-get

4
推荐指数
1
解决办法
2万
查看次数

systemctl奇怪的错误:无效的参数

这是我的服务文件:

[Unit]
Description=Daphne Interface

[Service]
ExecStartPre=cd /home/git/hsfzmun/server
ExecStart=/bin/bash/ -c "cd /home/git/hsfzmun/server && /home/git/virtualenvs/hsfzmun/bin/daphne -b 0.0.0.0 -p 8001 -v2 config.asgi:channel_layer"
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)

当我执行时,sudo systemctl start daphnei我得到:

Failed to start daphnei.service: Unit daphnei.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status daphnei.service' for details.
Run Code Online (Sandbox Code Playgroud)

和的结果systemctl status daphnei.service

* daphnei.service - Daphne Interface
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead) (Result: exit-code) since Mon 2017-02-13 19:55:10 CST; 13min ago
 Main …
Run Code Online (Sandbox Code Playgroud)

django ubuntu systemctl daphne

4
推荐指数
2
解决办法
1万
查看次数