`
lobin
  • 浏览: 417740 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

python

 
阅读更多

安装:

# wget --no-check-certificate https://www.python.org/ftp/python/2.6.2/Python-2.6.2.tgz

# tar -zxf Python-2.6.2.tgz

 

# ./configure --prefix=/usr/local/python-2.6.2

# vi Makefile

-DSVNVERSION=\"1.8.8\"

# make

# make install

 

覆盖老版本的Python

# mv /usr/bin/python /usr/bin/python-delete

# ln -s /usr/local/python-2.6.2/bin/python /usr/bin/python

 

pip

$ sudo python -m ensurepip --upgrade

Password:

The directory '/Users/admin/Library/Logs/pip' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Ignoring indexes: https://pypi.python.org/simple

The directory '/Users/admin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Requirement already up-to-date: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

Collecting pip

Installing collected packages: pip

 

Successfully installed pip-6.1.1

 

 

# >python Sample1.py
# hello, world

class Feature: 
	'feature'
	def __init__(self, att, value): 
		self._att = att
		self._value = value
		
	def att(self):
		"att"
		return self._att
		
	def value(self):
		"value"
		return self._value

if __name__ == '__main__': 
	print("hello, world")
	f = Feature("att1", "value of att1")
	print(f.att())
	print(f.value())







# >python Sample1.py
# 


import socket

if __name__ == '__main__': 
	print("hello, world")
	s = socket.socket()
	host = socket.gethostname()
	s.bind(("localhost", 12345))
	s.listen(5)
	
	print("startup...")
	
	while True: 
		c, addr = s.accept()
		print('remote address', addr)
	
		c.send(("hello, world").encode())
	
		c.close()
	










# >python Sample1.py
# 


import socket

if __name__ == '__main__': 
	print("hello, world")
	s = socket.socket()
	host = socket.gethostname()
	s.connect(("localhost", 12345))
	print ((s.recv(1024)).decode())
	s.close()  

 

0
0
分享到:
评论

相关推荐

    python3.7-python3.8-python3.9-python3.10对应的dlib安装包.whl.zip

    python3.7_python3.8_python3.9_python3.10对应的dlib安装包.whl.zippython3.7_python3.8_python3.9_python3.10对应的dlib安装包.whl.zippython3.7_python3.8_python3.9_python3.10对应的dlib安装包.whl.zippython...

    Python 禁止窗体显示最大化按钮及调整窗体大小 Python源码

    PythoPython 禁止窗体显示最大化按钮及调整窗体大小 Python源码Python 禁止窗体显示最大化按钮及调整窗体大小 Python源码n 禁止窗体显示最大化按钮及调整窗体大小 Python源码Python 禁止窗体显示最大化按钮及调整...

    Python入门-选择Python版本

    Python是一种广泛使用的高级编程语言,尤其在Web开发、数据分析、人工智能等领域有着广泛应用。对于初学者而言,选择合适的Python版本是入门的第一步。Python有两个主要的活跃版本:Python 2 和 Python 3。这两个...

    python实现按键精灵工具合集

    python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵...

    使用Python调用OpenAI接口-OpenAI接口调用python库源码.zip

    使用Python调用OpenAI接口-OpenAI接口调用python库源码.zip使用Python调用OpenAI接口-OpenAI接口调用python库源码.zip使用Python调用OpenAI接口-OpenAI接口调用python库源码.zip使用Python调用OpenAI接口-OpenAI接口...

    Python 如何批量提取Word文档的页码(并计算总页码)Python源码

    Python 如何批量提取Word文档的页码(并计算总页码)Python源码Python 如何批量提取Word文档的页码(并计算总页码)Python源码Python 如何批量提取Word文档的页码(并计算总页码)Python源码Python 如何批量提取Word...

    source insight python Python.CLF 语言包

    source insight python Python.CLF 语言包 SourceInsight作如下配置: (1)选择Options > Preferences,单击Languages选项; (2)单击import按钮,装载并导入Python.CLF; (3)这时可以看到,左栏语言列表多...

    Python 解决图片不能被一同打包到可执行文件中的问题 Python源码

    Python 解决图片不能被一同打包到可执行文件中的问题 Python源码Python 解决图片不能被一同打包到可执行文件中的问题 Python源码Python 解决图片不能被一同打包到可执行文件中的问题 Python源码Python 解决图片不能...

    超完整 Python基础入门知识教程 Python从入门到进阶知识大全 Python开发基础知识能力集全部课件 1885页

    Python基础入门知识教程 Python是一个功能强大且广泛应用的高级编程语言。了解Python的发展历史、优缺点、应用场景、数据类型转换、编写第一个Python程序、注释的引入、中文支持、输入变量、类型标示符、关键字、...

    java2python--java代码转python工具

    Java到Python的转换工具,如标题“java2python”所示,是编程领域中的一种实用技术,旨在帮助开发者将已有的Java代码转换为Python语言。这种转换对于那些熟悉Java但希望进入Python生态系统,或者想要利用Python特定...

    Python 八股文.pdf

    Python是一种高级编程语言,以其简洁明了的语法和丰富的标准库而受到广泛欢迎。"Python八股文"可能指的是对Python基础知识的一种系统性总结。在Python中,有以下几个关键概念值得深入探讨: 1. **内置电池...

    Programming in Python 3 A Complete Introduction to the Python Language

    The purpose of this book is to show you how to write Python programs in good idiomatic Python 3 style, and to be a useful reference for the Python 3 language after the initial reading. Although Python...

    Python聊天机器人,智能问答系统.zip

    Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python聊天机器人,智能问答系统 Python...

    python计算机二级题库(附带答案)

    python计算机二级题库(附带答案)python计算机二级题库(附带答案)python计算机二级题库(附带答案)python计算机二级题库(附带答案)python计算机二级题库(附带答案)python计算机二级题库(附带答案)python...

    C++调用python,免安装python环境运行

    首先,要实现C++调用Python,通常会用到Python的`Python.h`头文件,它是Python的C API,允许C/C++代码与Python解释器进行交互。但是,这种常规方法要求目标系统已经安装了Python环境。为了解决这个问题,项目可能...

    基于Python的火车票分析系统源码

    基于Python的火车票分析系统源码基于Python的火车票分析系统源码基于Python的火车票分析系统源码基于Python的火车票分析系统源码基于Python的火车票分析系统源码基于Python的火车票分析系统源码基于Python的火车票...

    python2.7 64位

    Python 2.7 64位是Python编程语言的一个特定版本,专为64位操作系统设计,例如Windows 7。这个版本提供了对64位计算的支持,允许处理更大的内存和数据集,对于需要处理大量数据或者运行高性能计算的程序特别有利。在...

    Python上市公司财报分析系统源码.zip

    Python上市公司财报分析系统源码 Python上市公司财报分析系统源码 Python上市公司财报分析系统源码 Python上市公司财报分析系统源码 Python上市公司财报分析系统源码 Python上市公司财报分析系统源码...

    中央财经大学会计学院Python作业.zip

    中央财经大学会计学院Python作业 中央财经大学会计学院Python作业 中央财经大学会计学院Python作业 中央财经大学会计学院Python作业 中央财经大学会计学院Python作业 中央财经大学会计学院Python作业 ...

Global site tag (gtag.js) - Google Analytics