windows安装fdfs_lient报错"fdfs_client/sendfilemodule: fatal error C1189: #error: platfom not supported"

windows安装fdfs_lient报错"fdfs_client/sendfilemodule: fatal error C1189: #error: platfom not supported"

报错详情(报错内容:windows这个平台不支持fdfs_client)

running install
running bdist_egg
running egg_info
writing fdfs_client_py.egg-info\PKG-INFO
writing dependency_links to fdfs_client_py.egg-info\dependency_links.txt
writing top-level names to fdfs_client_py.egg-info\top_level.txt
reading manifest file 'fdfs_client_py.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'fdfs_client\client.conf'
writing manifest file 'fdfs_client_py.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'fdfs_client.sendfile' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ie:\anaconda3\include -Ie:\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcfdfs_client/sendfilemodule.c /Fobuild\temp.win-amd64-3.6\Release\fdfs_client/sendfilemodule.obj
sendfilemodule.c
fdfs_client/sendfilemodule.c(53): fatal error C1189: #error:  platfom not supported
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

下载‘fdfs_client-py-master.zip’包之后,进入windows虚拟环境下解压fdfs_client-py-master.zip

windows安装fdfs_lient报错
windows搭建的虚拟环境中,在当前目录下采用‘python setup.py install’安装,就会报错:
windows安装fdfs_lient报错
在linux系统中采用同样的安装方式,安装信息如下:
windows安装fdfs_lient报错
linux能正常安装,但是windows就不能,但是也很好解决。

解决方式

将"fdfs_client-py-master.zip"解压后的fdfs_client目录复制到自己的虚拟环境的库中,比如我的虚拟环境名称django_env, 把文件复制到django_env\Lib\site-packages\目录下,这样,你的虚拟环境就已经安装好fdfs_client了。
windows安装fdfs_lient报错

windows安装fdfs_lient报错
现在fdfs_client已经安装好了,但是还不能使用,还要继续安装两个模块mutagen 和requests

pip install mutagen 
pip isntall requests 

修改fdfs_client/storage_client.py文件,将第12行删除或注释(否则,使用时会报错ImportError: No module named sendfile)

# from fdfs_client.sendfile import *   将改行注释或者删除

windows安装fdfs_lient报错
然后创建client.conf文件,我所创建的路径为“F:\Projects\django_env”。
windows安装fdfs_lient报错
client.conf文件中将以下代码复制及进去,修改并保存,修改tracker_server=127.0.0.1:22122这行,将‘127.0.0.1’修改成你自己的服务器地址(22122端口需要自己在阿里云上配置安全规则),还需要修改‘base_path=F:\Projects\django_env’,base_path修改成你自己的path。

# connect timeout in seconds
# default value is 30s
connect_timeout=30

# network timeout in seconds
# default value is 30s
network_timeout=60

# the base path to store log files
base_path=F:\Projects\django_env

# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=127.0.0.1:22122

#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info

# if use connection pool
# default value is false
# since V4.05
use_connection_pool = false

# connections whose the idle time exceeds this time will be closed
# unit: second
# default value is 3600
# since V4.05
connection_pool_max_idle_time = 3600

# if load FastDFS parameters from tracker server
# since V4.05
# default value is false
load_fdfs_parameters_from_tracker=false

# if use storage ID instead of IP address
# same as tracker.conf
# valid only when load_fdfs_parameters_from_tracker is false
# default value is false
# since V4.05
use_storage_id = false

# specify storage ids filename, can use relative or absolute path
# same as tracker.conf
# valid only when load_fdfs_parameters_from_tracker is false
# since V4.05
storage_ids_filename = storage_ids.conf


#HTTP settings
http.tracker_server_port=80

#use "#include" directive to include HTTP other settiongs
##include http.conf

现在fdfs_client这么包就可以正常使用了

fdfs_client代码测试

测试代码:

from fdfs_client.client import Fdfs_client

client = Fdfs_client('F:/Projects/django_env/client.conf')
ret = client.upload_by_filename('timg.jpg')
print(ret)

windows安装fdfs_lient报错
输出控制台

F:\Projects\django_env\Scripts\python.exe F:/Projects/axf/fastdfs_demo/test.py
getting connection


{'Group name': 'group1', 'Remote file_id': 'group1\\M00/00/00/rBBx9lxQEX2AO4peAANB4Pemyig458.jpg', 'Status': 'Upload successed.', 'Local file name': 'timg.jpg', 'Uploaded size': '208.00KB', 'Storage IP': '47.98.173.29'}

Process finished with exit code 0

OK,能正常使用了。

你可能感兴趣的:(windows安装fdfs_lient报错"fdfs_client/sendfilemodule: fatal error C1189: #error: platfom not supported")