pip install greenlet出错

如题:

Installing collected packages: greenlet
  Running setup.py install for greenlet ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s5MENU/greenlet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s5MENU/greenlet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wkj7hW/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-s5MENU/greenlet/
    Complete output (13 lines):
    running install
    running build
    running build_ext
    building 'greenlet' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c greenlet.c -o build/temp.linux-x86_64-2.7/greenlet.o
    In file included from greenlet.c:5:0:
    greenlet.h:8:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s5MENU/greenlet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s5MENU/greenlet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wkj7hW/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

换了很多个greenlet版本都出错,从低到高都试了,最终成功的版本是

[root@node00 quotesys]# pip install greenlet==0.4.10
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: http://pypi.douban.com/simple
Collecting greenlet==0.4.10
  Downloading http://pypi.doubanio.com/packages/fd/4b/108108a5a4234b2c7f81a7e9513950caf5146c9b2d47664348dbe9aebaf8/greenlet-0.4.10-cp27-cp27mu-manylinux1_x86_64.whl (41 kB)
     |████████████████████████████████| 41 kB 2.2 MB/s 
Installing collected packages: greenlet
Successfully installed greenlet-0.4.10

python版本是python2.7

### 解决 `pip install citylearn` 的常见错误 当遇到 `pip install citylearn` 安装失败的情况时,可以尝试以下几种方法来解决问题。 #### 使用国内镜像源加速安装过程 有时由于网络原因可能导致连接超时等问题。可以通过指定清华大学的 PyPI 镜像源来进行安装: ```bash pip install citylearn -i https://pypi.tuna.tsinghua.edu.cn/simple/ ``` 为了使更改长期生效,可配置全局 Pip 设置指向该镜像地址[^2]: ```bash python -m pip install --upgrade pip pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple ``` #### 更新 Python 和 Pip 版本 确保使用的 Python 及其包管理工具处于最新版本有助于减少兼容性问题带来的麻烦。执行命令更新它们: ```bash python -m pip install --upgrade pip setuptools wheel ``` #### 创建虚拟环境再进行安装 创建一个新的虚拟环境并在此环境中重新尝试安装 CityLearn 库可能也会有所帮助。这能避免与其他已有的库发生冲突。 ```bash python -m venv myenv source myenv/bin/activate # Linux 或 macOS 用户 myenv\Scripts\activate # Windows 用户 pip install citylearn # 此处同样建议加上清华源参数 ``` #### 检查依赖项及其版本匹配情况 CityLearn 可能有特定版本的要求对于某些依赖库来说;因此查看官方文档确认所需的具体版本号,并手动调整这些依赖到合适的状态可能是必要的。 如果上述措施仍无法解决问题,则需进一步分析具体的报错信息以定位确切的原因所在。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值