概述
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-infoPKG-INFO
writing dependency_links to fdfs_client_py.egg-infodependency_links.txt
writing top-level names to fdfs_client_py.egg-infotop_level.txt
reading manifest file 'fdfs_client_py.egg-infoSOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'fdfs_clientclient.conf'
writing manifest file 'fdfs_client_py.egg-infoSOURCES.txt'
installing library code to buildbdist.win-amd64egg
running install_lib
running build_py
running build_ext
building 'fdfs_client.sendfile' extension
C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ie:anaconda3include -Ie:anaconda3include "-IC:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows Kits8.1includeshared" "-IC:Program Files (x86)Windows Kits8.1includeum" "-IC:Program Files (x86)Windows Kits8.1includewinrt" /Tcfdfs_client/sendfilemodule.c /Fobuildtemp.win-amd64-3.6Releasefdfs_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搭建的虚拟环境中,在当前目录下采用‘python setup.py install’安装,就会报错:
在linux系统中采用同样的安装方式,安装信息如下:
linux能正常安装,但是windows就不能,但是也很好解决。
解决方式
将"fdfs_client-py-master.zip"解压后的fdfs_client目录复制到自己的虚拟环境的库中,比如我的虚拟环境名称django_env, 把文件复制到django_envLibsite-packages目录下,这样,你的虚拟环境就已经安装好fdfs_client了。
现在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 * 将改行注释或者删除
然后创建client.conf文件,我所创建的路径为“F:Projectsdjango_env”。
client.conf文件中将以下代码复制及进去,修改并保存,修改tracker_server=127.0.0.1:22122这行,将‘127.0.0.1’修改成你自己的服务器地址(22122端口需要自己在阿里云上配置安全规则),还需要修改‘base_path=F:Projectsdjango_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:Projectsdjango_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)
输出控制台
F:Projectsdjango_envScriptspython.exe F:/Projects/axf/fastdfs_demo/test.py
getting connection
<fdfs_client.connection.Connection object at 0x0000015859735BE0>
<fdfs_client.fdfs_protol.Tracker_header object at 0x0000015859735BA8>
{'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"windows安装fdfs_lient报错"fdfs_client/sendfilemodule: fatal error C1189: #error: platfom not supported"报错详情(报错内容:windows这个平台不支持fdfs_client)的全部内容,希望文章能够帮你解决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)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复