python 开发环境部署

pip 安装软件报错:“Command 'lsb_release -a' returned non-zero

参考解决https://www.jianshu.com/p/3a2877edebe8

现在的python一般就直接用anaconda里的python了。但pip总是报错,

需要

cp /usr/lib/python3/dist-packages/lsb_release.py   /opt/anaconda3/lib/python3.8/site-packages/

pip

通过google搜索到,2019.4月的版本是19. 需要更换源,否则会挺慢。

Windows下更换pip源为清华源

打开appdata文件夹,在资源管理器的地址栏输入%appdata%后回车:

新建一个pip文件夹,在pip文件夹里面新建一个配置文件pip.ini:

在配置文件中输入如下内容后保存即可:
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

再次使用pip,即会使用新源。

安装特定版本,类似于这样

pip install tensorflow==1.8

加速访问github

更改hosts,增加

192.30.253.112 github.com

151.101.13.194 github.global.ssl.fastly.net

利用shdaowsocks加速git

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

IDE/编辑器

vs code

因为python3.7在python2.7后面安装,vscode缺省认可3.7版本,尽管2.7的路径在path里已经设置了。

可以在%appdata%codeusersettings.json里这样设置:

{
"python.pythonPath": "c:\develop\python27\python",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
}

pip分别安装 pylint, flake8

sublime

参见 https://www.jianshu.com/p/c9cc9cdaa5d5

原文地址:https://www.cnblogs.com/tangxiaosheng/p/10649414.html