资源简介
安装opencc-python出错时:解压缩distribute_setup.zip后,把distribute_setup.py放到C:\Python\Lib
代码片段和文件信息
#!python
“““Bootstrap distribute installation
If you want to use setuptools in your package‘s setup.py just include this
file in the same directory with it and add this to the top of your setup.py::
from distribute_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools set a download
mirror or use an alternate download directory you can do so by supplying
the appropriate options to ‘‘use_setuptools()‘‘.
This file can also be run as a script to install or upgrade setuptools.
“““
import os
import sys
import time
import fnmatch
import tempfile
import tarfile
from distutils import log
try:
from site import USER_SITE
except ImportError:
USER_SITE = None
try:
import subprocess
def _python_cmd(*args):
args = (sys.executable) + args
return subprocess.call(args) == 0
except ImportError:
# will be used for python 2.3
def _python_cmd(*args):
args = (sys.executable) + args
# quoting arguments if windows
if sys.platform == ‘win32‘:
def quote(arg):
if ‘ ‘ in arg:
return ‘“%s“‘ % arg
return arg
args = [quote(arg) for arg in args]
return os.spawnl(os.P_WAIT sys.executable *args) == 0
DEFAULT_VERSION = “0.6.27“
DEFAULT_URL = “http://pypi.python.org/packages/source/d/distribute/“
SETUPTOOLS_FAKED_VERSION = “0.6c11“
SETUPTOOLS_PKG_INFO = “““\
metadata-Version: 1.0
Name: setuptools
Version: %s
Summary: xxxx
Home-page: xxx
Author: xxx
Author-email: xxx
License: xxx
Description: xxx
“““ % SETUPTOOLS_FAKED_VERSION
def _install(tarball install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn(‘Extracting in %s‘ tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn(‘Now working in %s‘ subdir)
# installing
log.warn(‘Installing Distribute‘)
if not _python_cmd(‘setup.py‘ ‘install‘ *install_args):
log.warn(‘Something went wrong during the installation.‘)
log.warn(‘See the error message above.‘)
finally:
os.chdir(old_wd)
def _build_egg(egg tarball to_dir):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn(‘Extracting in %s‘ tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn(‘Now working in %s‘ subdir)
# building an egg
log.warn(‘Building a Distribute e
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 16734 2015-05-19 11:09 distribute_setup.py
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论