我想在我的系统上安装 eventlet
,以便让“群”进行软件部署。但终端显示 gcc 错误:
root@agrover-OptiPlex-780:~# easy_install -U eventlet
Searching for eventlet
Reading http://pypi.python.org/simple/eventlet/
Reading http://wiki.secondlife.com/wiki/Eventlet
Reading http://eventlet.net
Best match: eventlet 0.9.16
Processing eventlet-0.9.16-py2.7.egg
eventlet 0.9.16 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages/eventlet-0.9.16-py2.7.egg
Processing dependencies for eventlet
Searching for greenlet>=0.3
Reading http://pypi.python.org/simple/greenlet/
Reading https://github.com/python-greenlet/greenlet
Reading http://bitbucket.org/ambroff/greenlet
Best match: greenlet 0.3.4
Downloading http://pypi.python.org/packages/source/g/greenlet/greenlet- 0.3.4.zip#md5=530a69acebbb0d66eb5abd83523d8272
Processing greenlet-0.3.4.zip
Writing /tmp/easy_install-_aeHYm/greenlet-0.3.4/setup.cfg
Running greenlet-0.3.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_aeHYm/greenlet-0.3.4/egg-dist-tmp-t9_gbW
In file included from greenlet.c:5:0:
greenlet.h:8:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1`
为什么找不到 Python.h
?
您的安装失败,因为您没有安装 python 开发头文件。您可以通过 ubuntu/debian 上的 apt 执行此操作:
sudo apt-get install python-dev
对于 python3 使用:
sudo apt-get install python3-dev
对于 eventlet
,您可能还需要安装 libevent
库,因此如果您遇到错误,您可以安装 libevent:
sudo apt-get install libevent-dev
对于 Fedora:
sudo yum install python-devel
sudo yum install libevent-devel
最后:
sudo easy_install gevent
在 CentOS 上对我有用的是:
sudo yum -y install gcc
sudo yum install python-devel
unable to execute 'gcc': No such file or directory error: command 'gcc' failed with exit status 1
sudo yum install python34-devel
用于 python 3.x,因为另一个仅用于 python 2.x
对于 Redhat 版本(Centos 7)使用以下命令安装 Python 开发包
蟒蛇 2.7
sudo yum install python-dev
蟒蛇 3.4
sudo yum install python34-devel
蟒蛇 3.6
sudo yum install python36-devel
如果问题仍未解决,请尝试安装以下软件包 -
sudo yum install python-devel
sudo yum install openssl-devel
sudo yum install libffi-devel
No package python-dev available.
我收到了。
在 MacOS 上,我无法安装需要 pystan
的 fbprophet
,而需要 gcc
才能编译。我会一直收到同样的错误:command 'gcc' failed with exit status 1
我想我为自己解决了这个问题:
我使用 brew install gcc
安装了最新版本,最终成为 gcc-8
然后我确保当 gcc
运行时它会使用 gcc-8
。
它可能是因为我在 .zshrc
中添加了 alias gcc='gcc-8
(与 .bashrc
相同,但用于 zsh),或者因为我运行了 export PATH=/usr/local/bin:$PATH
(参见 comment)
另外:我所有的尝试都在一个虚拟环境中,我只是通过全局安装fbprophet
(使用pip)成功,但仍然没有成功在 venv 中
这是一篇旧帖子,但我在 AWS EC2 安装正则表达式时遇到了同样的问题。这对我来说非常有用
sudo yum -y install gcc
接下来
sudo yum -y install gcc-c++
如果还是不行,可以试试这个
sudo apt-get install build-essential
就我而言,它解决了问题。
shap
库的问题。
JPype1
库一起使用
尝试这个 :
sudo apt-get install libblas-dev libatlas-base-dev
我在 Ubuntu 14.04 上遇到了类似的问题。对我来说,以下 Ubuntu 软件包
在 MacOS 上,我在尝试安装将 gcc
作为其依赖项之一的 fbprophet
时也遇到了问题。
在尝试了@Boris 推荐的几个步骤后,Facebook Prophet project page 中的以下命令最终对我有用。
conda install -c conda-forge fbprophet
它为 fbprophet
安装了所有需要的依赖项。确保您已安装 anaconda。
marisa-trie
同样有效:conda install -c conda-forge python-marisa-trie
This page 将挽救您的生命,因为即将出现的所有其他 lib 问题,
对于高山(>=3.6),使用
apk --update --upgrade add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev
对于 CentOS 7.2:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
安装小事件:
sudo yum install python-devel
sudo easy_install -ZU eventlet
终端信息:
[root@localhost ~]# easy_install -ZU eventlet
Searching for eventlet
Reading http://pypi.python.org/simple/eventlet/
Best match: eventlet 0.19.0
Downloading https://pypi.python.org/packages/5a/e8/ac80f330a80c18113df0f4f872fb741974ad2179f8c2a5e3e45f40214cef/eventlet-0.19.0.tar.gz#md5=fde857181347d5b7b921541367a99204
Processing eventlet-0.19.0.tar.gz
Running eventlet-0.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Hh9GQY/eventlet-0.19.0/egg-dist-tmp-rBFoAx
Adding eventlet 0.19.0 to easy-install.pth file
Installed /usr/lib/python2.6/site-packages/eventlet-0.19.0-py2.6.egg
Processing dependencies for eventlet
Finished processing dependencies for eventlet
对于 openSUSE 42.1 Leap Linux 使用这个
sudo zypper install python3-devel
我正在使用 MacOS catalina 10.15.4。所有发布的解决方案都不适合我。对我有用的是:
>> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
>> env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2==2.8.4
Collecting psycopg2==2.8.4
Using cached psycopg2-2.8.4.tar.gz (377 kB)
Installing collected packages: psycopg2
Attempting uninstall: psycopg2
Found existing installation: psycopg2 2.7.7
Uninstalling psycopg2-2.7.7:
Successfully uninstalled psycopg2-2.7.7
Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.8.4
将 pip3 用于 python3
从源代码构建并安装,这在最新版本(10.3+)中已修复:
mkdir -p /tmp/install/netifaces/
cd /tmp/install/netifaces && wget -O "netifaces-0.10.4.tar.gz" "https://pypi.python.org/packages/source/n/netifaces/netifaces-0.10.4.tar.gz#md5=36da76e2cfadd24cc7510c2c0012eb1e"
tar xvzf netifaces-0.10.4.tar.gz
cd netifaces-0.10.4 && python setup.py install
同样,我这样修复它(注意 python34
):
sudo yum install python34-devel
sudo apt install gcc
它适用于 Ubuntu 20.10 上的 PyCharm。
如果您正在迁移到更现代的 python3 版本,例如 python3.5 to python3.8
如果您已经安装了推荐的库来处理 gcc 构建 python3-dev
+ 建议的其他库,您可能需要检查/升级失败的库版本.
这取决于包装。更高版本的 python3 可能不支持某些版本的软件包。
不定期副业成功案例分享
sudo yum install python-devel
sudo apt-get update
。sudo apt-get install python-dev
出现错误。