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搭建的虚拟环境中,在当前目录下采用‘python setup.py install’安装,就会报错:
在这里插入图片描述
在linux系统中采用同样的安装方式,安装信息如下:
在这里插入图片描述
linux能正常安装,但是windows就不能,但是也很好解决。

解决方式

将"fdfs_client-py-master.zip"解压后的fdfs_client目录复制到自己的虚拟环境的库中,比如我的虚拟环境名称django_env, 把文件复制到django_env\Lib\site-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:\Projects\django_env”。
在这里插入图片描述
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)

在这里插入图片描述
输出控制台

F:\Projects\django_env\Scripts\python.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,能正常使用了。

启动fdfs_trackerd报错“Job for fdfs_trackerd.service failed because the control process exited with error code”,这通常意味着系统在尝试启动fdfs_trackerd服务时遇到了一些错误,并且这个服务的控制进程因为某个错误代码而终止了。 这个问题可能是由多种原因造成的: 1. **配置错误**:检查`/etc/fdfs/tracker.conf`文件,确认所有设置是否正确无误。例如,端口号、路径等配置项是否与其他组件冲突或不符合预期。 2. **权限问题**:确保运行fdfs_trackerd的服务用户有正确的读写权限访问必要的目录。特别是对于存储集群使用的数据目录。 3. **依赖问题**:确保所有需要的库和依赖都已正确安装并指向最新版本。有时候,某些依赖库的旧版本可能会导致兼容性问题。 4. **资源限制**:检查系统的CPU、内存和磁盘空间是否有足够的资源供fdfs_trackerd使用。过低的资源可能导致程序崩溃。 5. **错误日志**:查看错误日志文件(如`/var/log/syslog` 或 `/var/log/fdfs/tracker.log`),从中获取更多的错误信息和堆栈跟踪,可以帮助定位问题的具体原因。 6. **重启失败机制**:某些服务的失败处理机制可能导致在多次失败尝试后停止响应。检查服务的日志看是否存在反复失败的信息,并尝试通过手动操作或修改配置来解决问题。 7. **启动脚本问题**:如果使用的是特定的启动脚本(如systemd服务单元文件),则需要检查该脚本是否有错误,比如配置选项、调用命令的方式等。 解决这类问题的一般步骤包括: - 首先,详细阅读错误信息,了解具体的错误代码含义。 - 检查相关的配置文件和日志记录。 - 根据发现的问题调整配置或修复系统环境。 - 尝试再次启动服务,并持续监控日志和系统状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值