网上下载 fdfs_client-py-master.zip 解压
cd 到解压后的路径fdfs_client-py-master
敲入:python setup.py install
报错:
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
WIN下需要删除一些代码段:1.解压后的fdfs_client-py-masterfdfs_client 目录下的storage_client.py屏蔽第12行 # from fdfs_client.sendfile import *
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 # filename: storage_client.py 4 5 import os, stat 6 import struct 7 import socket 8 import datetime 9 import errno 10 from fdfs_client.fdfs_protol import * 11 from fdfs_client.connection import * 12 # from fdfs_client.sendfile import * 13 from fdfs_client.exceptions import ( 14 FDFSError, 15 ConnectionError, 16 ResponseError, 17 InvaildResponse, 18 DataError 19 ) 20 from fdfs_client.utils import *
在安装包的根目录下有一个setup.py里的sdict中键为ext_modules的这组键值对
#!/usr/bin/env python import os from fdfs_client import __version__ try: from setuptools import setup, Extension except ImportError: from distutils.core import setup, Extension f = open(os.path.join(os.path.dirname(__file__), 'README.md')) long_description = f.read() f.close() sdict = { 'name': 'fdfs_client-py', 'version': __version__, 'description': 'Python client for Fastdfs ver 4.06', 'long_description': long_description, 'author': 'scott yuan', 'author_email': 'scottzer8@gmail.com', 'maintainer': 'scott yuan', 'maintainer_email': 'scottzer8@gmail.com', 'keywords': ['Fastdfs', 'Distribute File System'], 'license': 'GPLV3', 'packages': ['fdfs_client'], 'classifiers': [ 'Development Status :: 1 - Production/Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: GPLV3', 'Operating System :: OS Independent', 'Programming Language :: Python'], #'ext_modules': [Extension('fdfs_client.sendfile', # 注释掉这一行 # sources=['fdfs_client/sendfilemodule.c'])], # 还有这一行都需要注释 } setup(**sdict)
注释完成之后,在分别安装pip install mutagen 和 pip install requests
这两个包也安装完成后,再去那个目录下执行
python setup.py install