centos7安装gevent出现的一些问题

在尝试升级pip和setuptools时遇到权限错误,建议使用--user标志以避免需要超级用户权限。通过这个方法,软件包将安装在用户主目录下。同时,如果安装gevent时缺少编译器,可以使用yuminstallgcc-c++来解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

以下这段提醒我,根据错误信息显示,你在尝试升级 pip 和 setuptools 时遇到了权限问题。报错信息表明你没有足够的权限创建目录 /usr/local/lib/python3.6/site-packages/pip。

使用 --user 标志以用户身份运行命令:

pip3 install --upgrade --user pip setuptools

这将会将软件包安装到你的用户主目录下的 .local 目录中,而不是系统范围的位置。这样你就不需要超级用户权限来进行安装。

[david@localhost CTFd-master]$ pip3 install --upgrade pip setuptools

Cache entry deserialization failed, entry ignored
Collecting pip
  Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 844kB/s 
Cache entry deserialization failed, entry ignored
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/b0/3a/88b210db68e56854d0bcf4b38e165e03be377e13907746f825790f3df5bf/setuptools-59.6.0-py3-none-any.whl (952kB)
    100% |████████████████████████████████| 962kB 1.4MB/s 
Installing collected packages: pip, setuptools
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install
    **kwargs
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
    strip_file_prefix=strip_file_prefix
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/pip'

在下段代码中,我们可以优先考虑pip3安装是需要添加“–user”

[david@localhost CTFd-master]$ pip3 install --user gevent
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting gevent
  Downloading gevent-22.10.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.8 MB)
     |████████████████████████████████| 5.8 MB 4.1 MB/s            
Requirement already satisfied: setuptools in /home/david/.local/lib/python3.6/site-packages (from gevent) (59.6.0)
Requirement already satisfied: zope.event in /home/david/.local/lib/python3.6/site-packages (from gevent) (4.6)
Requirement already satisfied: zope.interface in /home/david/.local/lib/python3.6/site-packages (from gevent) (5.5.2)
Collecting greenlet>=2.0.0
  Downloading greenlet-2.0.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (564 kB)
     |████████████████████████████████| 564 kB 5.8 MB/s            
Installing collected packages: greenlet, gevent
Successfully installed gevent-22.10.2 greenlet-2.0.2

另外如果出现以下错误说明需要安装编译器

 gcc -pthread -Wno-unused-result -Wsign-compare -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/python3.6m -c src/greenlet/greenlet.cpp -o build/temp.linux-x86_64-3.6/src/greenlet/greenlet.o
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' failed with exit status 1

直接输入以下命令可以解决安装gevent的问题

sudo yum install gcc-c++
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

David_Jou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值