在Ubuntu 14.04上,我使用Pycharm Professional Edition。启动调试会话时,在Pycharm的事件日志中看到以下消息:
可用的Python调试器扩展
Cython扩展程序可以加快Python调试速度
点击Install
会弹出一个带有错误消息的窗口:
我也在这里描述了文本,以便其他人可以更容易地找到它:
编译Cython扩展错误
非零退出代码(1):
无法执行“ gcc”:没有此类文件或目录
错误:命令'gcc'失败,退出状态为1
要寻找解决方案:
我根据上述链接/usr/bin/python3 /<PYCHARM_INSTALLATION_PATH>/helpers/pydev/setup_cython.py build_ext --inplace
手动编译了Cython加速器。此操作成功完成,但对错误消息没有帮助。
我添加了python-3.6-dev存储库:
sudo add-apt-repository ppa:deadsnakes/ppa
,已执行:sudo apt-get update && sudo apt-get dist-upgrade
并安装了python-3.6-dev:sudo apt-get install python3.6-dev
成功完成,但不会更改上面的弹出错误消息。
我还能检查或执行什么?
编辑 关于gcc的安装,如下所示:
user@user-computer:~$ gcc
The program 'gcc' is currently not installed. You can install it by typing:
sudo apt-get install gcc
user@user-computer:~$ sudo apt-get install gcc
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version.
The following packages were automatically installed and are no longer required:
libseccomp2 libwireshark5 libwiretap4 libwsutil4
linux-image-3.13.0-160-generic linux-image-extra-3.13.0-160-generic
linux-lts-xenial-tools-4.4.0-137 linux-signed-image-4.4.0-137-generic
linux-tools-4.4.0-137-generic squashfs-tools
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
user@user-computer:~$ gcc
The program 'gcc' is currently not installed. You can install it by typing:
sudo apt-get install gcc
答案 0 :(得分:2)
供以后参考:
Cython
使用gcc
(默认情况下),需要验证它是否已安装并正常工作。
由于它默认安装在最新的Ubuntu
发行版中,如果运行不正常,则可以按照OP修复并使用sudo apt install --reinstall gcc
答案 1 :(得分:2)
起初:
sudo apt install --reinstall gcc
然后,下面的运行命令取决于Python
的版本,您正在使用:
对于 Python 2.x ,使用:
$ sudo apt-get install python-dev
对于 Python 3.x ,使用:
$ sudo apt-get install python3-dev
对于 Python 3.8 ,使用:
$ sudo apt-get install python3.8-dev