栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

ubuntu开发环境搭建汇总

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ubuntu开发环境搭建汇总

ubuntu开发环境搭建汇总
  • apt换源 (20.04)
  • Git
  • ssh
  • vim
  • anaconda
  • pycharm
  • pip
  • 未完待续

apt换源 (20.04)
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak  # 备份
sudo vi /etc/apt/sources.list

# 全部替换为下面 (阿里源)
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

# apt更新升级
sudo apt-get update
sudo apt-get upgrade
Git

安装并配置

sudo apt-get install git
git config --global user.name "username"
git config --global user.email xxx

查看配置

git config --list  # 查看全部配置
git config user.name  # 查看一个配置
ssh

安装并生成ssh key

sudo apt-get install ssh
cd ~/.ssh
ssh-keygen -o

将.pub文件中的公钥加到远程git平台的ssh配置中

vim

安装

sudo apt-get install vim
vim ~/.vimrc

配置如下

set nocompatible  " 不与 Vi 兼容
syntax on  " 打开语法高亮
set showmode  " 在底部显示当前处于命令模式还是插入模式
set showcmd  " 命令模式下,在底部显示当前键入的指令
set encoding=utf-8
" set t_Co=256  " 启用256色
set autoindent  " 自动缩进
set tabstop=4  " 按下 Tab 键时,Vim 显示的空格数
set shiftwidth=4  " 在文本上按下>>、<<或者==时,每一级的字符数
set expandtab  " 自动将 Tab 转为空格
set number  " 显示行号
" set mouse=a  " 设置鼠标可用
set relativenumber  " 显示光标所在的当前行的行号,其他行都为相对于该行的相对行号
" set showmatch  " 光标遇到圆括号、方括号、大括号时,自动高亮对应的另一个圆括号、方括号和大括号
set ignorecase  "  搜索是忽略大小写

设置行号后鼠标复制会将行号一起复制,可复制到"+寄存器解决
ubuntu默认安装的vim没有”+寄存器,解决如下:
sudo apt-get install vim-gtk

anaconda

https://www.anaconda.com/products/individual#Downloads

pycharm

https://www.jetbrains.com/pycharm/download
添加到favorite:pycharm启动首页,右下角Configure中找到Create Desktop Entry点击,然后即可在应用中找到pycharm添加到favorite。

pip

换源

mkdir ~/.pip
vim ~/.pip/pip.conf

添加配置如下(清华源)

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
未完待续
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/503693.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号