#pip #npm #conda

pip npm conda 换下载源

Pip 换 阿里源 linux下运行命令 vi ~/.pip/pip.confp[global] trusted-host = mirrors.aliyun.com index-url = http://mirrors.aliyun.com/pypi/simple Conda 换 清华源 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes Npm 换 淘宝源 一、使用淘宝镜像 1.临时使用 npm --registry https://registry.npm.taobao.org install express 2.持久使用 npm config set registry https://registry.npm.taobao.org 3.通过cnpm npm install -g cnpm --registry=https://registry.npm.taobao.org 二、使用官方镜像 npm config set registry https://registry.npmjs.org/ 三、查看npm源地址 npm config get registry

#pylint

windows7 pylint ASCII 问题解决

问题描述: UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-5: ordinal not in range(128) 原因是pip安装python包会加载我的用户目录,我的用户目录恰好是中文的,ascii不能编码。 解决办法是: 在python目录 Python27\Lib\site-packages 建一个文件 sitecustomize.py 内容写: import sys sys.setdefaultencoding('gbk') python会自动运行这个文件。 参考链接:https://www.v2ex.com/t/90659

#python

Python核心编程第三版-第二章代码运行 问题解决

当在windows和Mac上,练习对应的代码时 非常明显的错误就在于 传输类型 TypeError: a bytes-like object is required, not 'str' TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str self.wfile.write(b'[%s] %s' % (bytes(ctime(), 'utf-8'), bytes(self.rfile.readline(), 'utf-8'))) TypeError: encoding without a string argument 主要都是因为,通信的接收和发送都是byte的类型。 所以需要使用 bytes() 函数 以下是可以正常运行的代码 from socketserver import (TCPServer as TCP, StreamRequestHandler as SRH) from time import ctime HOST = "" PORT = 21467 BUFSIZ = 1024 ADDR = (HOST, PORT) class MyRequestHandler(SRH): def handle(self): print('connect. ...

React-Redux 父-Provider 子-connect

来源 Redux作者 React-Redux 两个主要 Api Provider connect 先放一边 React 的 context context 实现了,一个全局变量 const PropTypes = require('prop-types'); class Button extends React.Component { render() { return ( //################ <button style={{background: this.context.color}}> {this.props.children} </button> ); } } //################ Button.contextTypes = { color: PropTypes.string }; class Message extends React.Component { render() { return ( <div> {this.props.text} <Button>Delete</Button> </div> ); } } class MessageList extends React.Component { //################ getChildContext() { return {color: "purple"}; } render() { const children = this. ...