博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
socket服务器的搭建-Mac(转)
阅读量:7112 次
发布时间:2019-06-28

本文共 1829 字,大约阅读时间需要 6 分钟。

原文:

socket服务器可通过来搭建 

在终端输入命名:

python chatserver.py

看到提示:Iphone Chat server started表示创建成功. 

但是有的时候看到的提示是: 
No module named twisted.internet.protocol:表示本机上没有安装twisted,需要自己安装.

下载地址.

ope.interface/twisted官网下载地址: 

 

ope.interface/twisted 百度网盘下载地址: 

链接:  密码: rr13

步骤如下: 

1.苹果电脑一般都安装了,在终端,输“which python”或“which python3”,会显示python的安装目录。

2.先安装zope.interface,才能安装twisted. 

安装方法:下载gz压缩包,解压后,会看到有个”setup.py” 文件,在终端下,输入“python setup.py install”或“python3 setup.py install”.便可以安装zope.interface。 
如果出现

error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/ test-easy-install-411.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /Library/Python/2.7/site-packages/ **Perhaps your account does not have write access to this directory?** If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: http://peak.telecommunity.com/EasyInstall.html Please make the appropriate changes for your system and try again.

这一段错误,因为python路径是在系统路径下,默认不能写.(报错的原因就是因为权限不够) 

解决方案:使用命令

sudo python setup.py install

3.检查下MAC有没有自带twisted。 

检查方法:打开python命令行,输入“import twisted”,如果没有任何提示,说明你已经有twisted了,若提示没有”twisted”模块,则需要自己安装twisted。 
安装方法:参考zope.interface的安装,(如果权限不够,同样在命令之前加上sudo),安装完成之后再用”import twisted”一下 
出现下图表示通过 
测试 
之后就可以用命令,开启服务了

python chatserver.py

转载于:https://www.cnblogs.com/pengyingh/articles/7149530.html

你可能感兴趣的文章
原生和jQuery的ajax用法
查看>>
【Linux】Linux中 “there are stopped jobs”问题的解决方案
查看>>
[NPM] Use custom config settings in your npm scripts
查看>>
[NPM] Create a node script to replace a complex npm script
查看>>
Kinect2.0获取数据
查看>>
Python split()方法
查看>>
Linux~连接windows的ftp,unzip出现的问题
查看>>
arcgis api for js入门开发系列九热力图效果
查看>>
MySql无法远程登录以及IP被锁解决办法
查看>>
BZOJ 2716: [Violet 3]天使玩偶 [CDQ分治]
查看>>
温故而知新 小测试
查看>>
CSS margin-top 属性
查看>>
YxdJSON - Delphi 高性能 JSON 库(支持RTTI和序列化操作)
查看>>
C# 根据注册表获取当前用户的常用目录整理
查看>>
Python如何输出包含在对象中的中文字符?
查看>>
.NET Core项目从xproj+project.json向csproj迁移简介
查看>>
【转】浏览器的渲染原理
查看>>
如何使用光盘刻录大师旋转视频文件
查看>>
Linux前台的程序转到后台执行(关闭终端而不杀死命令)
查看>>
PS 如何把大嘴变小嘴
查看>>