安装:WSL2(Ubuntu18.04)+miniconda3+mysql数据库+windows pycharm连接wsl

2023-05-16

一、WSL2(Ubuntu18.04安装)

1、开启“适用于Linux的Windows子系统”
找到控制面板-程序和功能-启用或关闭Windows功能,选中“适用于Linux的Windows子系统”和“虚拟机平台”,然后点击确定;
然后立即重启电脑;
在这里插入图片描述
2、下载内核更新包并安装
在这里插入图片描述
3、在 Microsoft Store 中下载 Windows Terminal;
在这里插入图片描述
下载成功后,打开Windows Terminal,输入wsl --set-default-version 2;

wsl --set-default-version 2

4、在 Microsoft Store 中下载 Ubuntu18.04;
在这里插入图片描述
下载成功后,打开ubuntu,根据提示输入用户名和密码(加载时间可能会比较久)

参考文档


二、换源

1、将原来的源做一个备份:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、然后编辑源文件,删除文件中的所有内容,将下面的内容复制进去;

sudo vim /etc/apt/sources.list
# 中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

# 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

# 阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3、更新镜像源

sudo apt-get update

4、更新软件

sudo apt-get upgrade  

参考文件


三、安装miniconda3

1、下载miniconda3

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

下载miniconda3
2、安装miniconda3

bash Miniconda3-latest-Linux-x86_64.sh

安装miniconda3

  • 一直回车,知道问你是否接收协议,选yes
    在这里插入图片描述
  • 询问安装位置

Miniconda3 现在将安装到此位置: /home/cxl/miniconda3

  • 按 ENTER 确认位置
  • 按 CTRL-C 中止安装
  • 或在下方指定不同的位置

在这里插入图片描述

  • 询问是否要初始化

你希望安装程序初始化 Miniconda3
通过运行 conda init? [是|否]
如果选中 No,需要手动初始化,将miniconda加入环境变量

在这里插入图片描述
3、检查miniconda3安装成功没有:

conda activate

报错:
在这里插入图片描述
错误原因:
~/.bashrc文件没有配置好,需要在 ~/.bashrc 文件的最后一行加上miniconda3的bin路径

export PATH=$PATH:/home/cxl/anaconda3/bin

在这里插入图片描述
在这里插入图片描述
启用新的文件

source ~/.bashrc

四、安装Mysql数据库

1、下载mysql

sudo apt-get install mysql-client-core-5.7
sudo apt-get install mysql-client-5.7
sudo apt-get install mysql-server-5.7

2、设置密码
使用client的user和password登录

sudo cat /etc/mysql/debian.cnf

在这里插入图片描述

mysql -u debian-sys-maint -p
update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost'; 
update user set plugin="mysql_native_password"; 
flush privileges; 
quit;

在这里插入图片描述
重启mysql,就可以用新密码登录了;

sudo service mysql restart; 
mysql -u root -p

3、远程连接设置
编辑 mysqld.cnf 文件,注释掉 bind-address = 127.0.0.1

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

在这里插入图片描述
在这里插入图片描述
重启mysql服务

sudo service mysql restart

给root用户授权

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;

在这里插入图片描述
在这里插入图片描述

五、windows pycharm连接wsl

1、pycharm – setting – project:XXX – python Interpreter
在这里插入图片描述
在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

安装:WSL2(Ubuntu18.04)+miniconda3+mysql数据库+windows pycharm连接wsl 的相关文章

随机推荐

  • 修改ssh端口重启服务报错error: Bind to port 8822 on :: failed: Permission denied

    root 64 BabyishRecent VM vi etc ssh sshd config root 64 BabyishRecent VM systemctl restart sshdJob for sshd service fail
  • Linux之iptables(一、防火墙的概念)

    Linux之iptables 一 防火墙的概念 防火墙的概念 一 安全技术 入侵检测与管理系统 xff08 Intrusion Detection Systems xff09 xff1a 特点是不阻断任何网络访问 xff0c 量化 定位来自
  • Python调用海康SDK对接摄像机

    以前做过的项目都是通过 ffmpeg c 43 43 来捕获摄像机的 RSTP 视频流来处理视频帧 xff0c 抽空看了一下海康的SDK说明 xff0c 使用 python ctypes方式a实现了对海康SDK DLL的调用 可以进行视频预
  • 数码管点亮顺序——有错请纠正

    找了半天没有找到 xff0c 自己试了几个数试出来了 xff0c 记这个顺序图比记编码表要快些
  • css-input的美化

    原装input很丑陋 xff0c 我们需要人工对其进行装饰才能好看哦 xff01 首先取消选中时的蓝色外边框 xff1a outline style none 若你想取消外边框 xff1a border xff1a 0 或 border x
  • echarts-横向柱状图的左侧文字左对齐设置

    在需要左对齐的Y轴中这样设置 xff0c 设置完后会发现 xff0c 文字跟圆柱重合覆盖 xff08 跟你需要的位置有区别 xff09 yAxis axisLabel margin 80 textStyle align 39 left 39
  • 12108 - Extraordinarily Tired Students(特别困的学生)

    题目 xff1a When a student is too tired he can t help sleeping in class even if his favorite teacher is right here in front
  • 1211 Problem C 营救

    营救 题目描述 铁塔尼号遇险了 xff01 他发出了求救信号 距离最近的哥伦比亚号收到了讯息 xff0c 时间就是生命 xff0c 必须尽快赶到那里 通过侦测 xff0c 哥伦比亚号获取了一张海洋图 这张图将海洋部分分化成n n个比较小的单
  • JAVA: toCharArray()类 将字符串转为数组

    public class Demo public static void main String args String str 61 34 helloworld 34 char data 61 str toCharArray 将字符串转为
  • 能赢吗?

    Description 有一堆石子 xff0c 总共有n枚 xff0c 两人轮流拿 xff0c 最少拿一枚 xff0c 最多拿k枚 xff0c 拿到最后一枚的人获胜 先手拿的人可以保证自己必胜吗 xff1f Input 第一行输入一个整数T
  • python e指数函数,常用的e指数代码

    在 python中 xff0c 有一种函数叫做e指数函数 xff08 exponential function xff09 xff0c 它的名称非常的直接 xff0c 是我们在进行数值计算时经常用到的一种函数 下面就让我们一起来学习一下这种
  • 栈的概念及性质

    栈的基本概念 栈的定义 栈是一种只能在一端进行插入或删除的线性表 其中插入被称作进栈 xff0c 删除被称作出栈 允许进行插入或删除操作的一端被称为栈顶 xff0c 另一段被称为栈底 xff0c 栈底固定不变 其中 xff0c 栈顶由一个称
  • python requests post 使用方法

    使用python模拟浏览器发送post请求 span class token keyword import span requests 1 格式request post xff1a request span class token punc
  • 各类Python项目的项目结构及代码组织最佳实践

    1 了解Python项目文件组织结构非常重要 为什么要掌握pythob项目结构 xff1f 优秀的程序员都使用规范的项目代码结构 xff0c 了解这些好的习惯方式 xff0c 能帮助你快速读懂代码如果项目是几个人合作开发 xff0c 好的代
  • Python简单的位运算

    位运算 程序中的数在计算机内存中都是以二进制的形式存在的 xff0c 位运算就是直接对整数在内存中对应的二进制位进行操作 位运算分为 6 种如下 xff1a 1 按位与 按位与运算符 xff1a 参与运算的两个值 如果两个相应位都为1 则该
  • 【Linux】WLAN接口桥接

    一 内核补丁 因为Linux内核会在注册特定设备时将会将dev gt priv flags置为IFF DONT BRIDGE xff0c 所以现还不支持sta p2p client adhoc等无线接口加入到桥接中去的 xff0c 所以要支
  • Python学习小记-爬虫基础例子之抓取热门游戏排行榜-2020-3-2

    span class token keyword import span urllib span class token punctuation span request span class token keyword import sp
  • 《A Survey on Aspect-Based Sentiment Analysis: Tasks, Methods, and Challenges》阅读笔记

    忙活了一阵子后 xff0c 现在终于有空研究一下目前如火如荼的ABSA了 xff0c 当然 xff0c 还是先从综述出发 A Survey on Aspect Based Sentiment Analysis Tasks Methods a
  • A problem has occurred and the system can‘t recover问题的解决

    A problem has occurred and the system can 39 t recover问题的解决 问题描述解决方法参考博客 问题描述 启动后无法进入图形界面 xff0c 出现如下报错内容 按 ctrl 43 alt 4
  • 安装:WSL2(Ubuntu18.04)+miniconda3+mysql数据库+windows pycharm连接wsl

    一 WSL2 xff08 Ubuntu18 04安装 xff09 1 开启 适用于Linux的Windows子系统 找到控制面板 程序和功能 启用或关闭Windows功能 xff0c 选中 适用于Linux的Windows子系统 和 虚拟机