前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >cos-ftp-server安装踩坑指南

cos-ftp-server安装踩坑指南

原创
作者头像
105号运维实习生
修改2022-04-13 17:30:43
2.7K4
修改2022-04-13 17:30:43
举报
文章被收录于专栏:随手写写随手写写

在python2.7中安装cos-ftp-server出现的一些常见问题,记录下避免再次出现同样的问题

笔者基于系统版本:Centos 7.5.1804 ,Python版本2.7.5 进行问题排查踩坑。

版本信息
版本信息

安装步骤

安装必要环境

文档所述,使用pip安装以下几个模块

代码语言:txt
复制
pip install psutil
pip install pyftpdlib
pip install cos-python-sdk-v5

如果提示no command,则要安装python-pip

代码语言:javascript
复制
yum install python-pip -y

开始正式安装

项目地址:https://github.com/tencentyun/cos-ftp-server-V5

安装git(选)

已使用pip install cos-python-sdk-v5请忽略该步骤

已从github项目文件下载文件可以忽略安装git、下载项目

如果有兴趣可以找下怎么安装git2.x,yum 版本为 1.18,但不影响使用

代码语言:txt
复制
yum install -y git
下载项目
代码语言:txt
复制
git clone https://github.com/tencentyun/cos-ftp-server-V5.git
安装运行
代码语言:txt
复制
cd cos-ftp-server-V5
python setup.py install

到此基本安装完了,后续可以再回到文档中配置。配置没问题即可使用了。

安装提醒报错

提醒'extras_require' must be a dictionary

代码语言:txt
复制
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vwGRKd/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vwGRKd/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-mLL9IK
         cwd: /tmp/pip-install-vwGRKd/psutil/
    Complete output (5 lines):
    /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
      warnings.warn(msg)
    /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    error in psutil setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
报错截图1
报错截图1
  • 初步判断是与pip 自带的setuptools版本安装存在冲突
代码语言:txt
复制
pip install pip==20.3.4
pip install requests==2.22.0
pip install setuptools==44.1.1

注意:Python2目前已不提供维护,相应的python依赖包迭代不再支持,更多说明移步到官方说明

提醒gcc未安装

代码语言:txt
复制
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 -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o
    psutil/_psutil_common.c:9: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-VCi9XS/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-VCi9XS/psutil/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-A1ljvJ/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python2.7/psutil Check the logs for full command output.
报错截图2
报错截图2
  • 安装 python-devel
代码语言:txt
复制
yum install python-devel

其他-查看模块版本

方法1. 引入模块并进行查看

代码语言:txt
复制
>>> import requests
>>> requests.__version__
'2.9.0'

方法2. 使用help(模块名查看),在最后几行可以看到

代码语言:txt
复制
>>> help(requests)
···
···
VERSION
    2.9.0

AUTHOR
    Kenneth Reitz

方法3. 使用pip list 查看

代码语言:txt
复制
[root@VM-1-16-centos ~]# pip list|grep requests
requests (2.6.0)

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装步骤
    • 安装必要环境
      • 开始正式安装
        • 安装git(选)
        • 下载项目
        • 安装运行
    • 安装提醒报错
      • 提醒'extras_require' must be a dictionary
        • 提醒gcc未安装
        • 其他-查看模块版本
        相关产品与服务
        对象存储
        对象存储(Cloud Object Storage,COS)是由腾讯云推出的无目录层次结构、无数据格式限制,可容纳海量数据且支持 HTTP/HTTPS 协议访问的分布式存储服务。腾讯云 COS 的存储桶空间无容量上限,无需分区管理,适用于 CDN 数据分发、数据万象处理或大数据计算与分析的数据湖等多种场景。
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档