虚拟机安装共享文件夹
设置->共享文件夹->添加共享文件夹->勾选自动挂载和固定分配(有时候默认就是固定分配)->点击确定
我建立了一个share目录,定原系统的文件夹名为Ubuntu
输入命令
sudo mount -t vboxsf Ubuntu /home/.../share
备注,一定要在ubuntu上安装增强功能,点击设备->安装增强功能
安装VS code
在https://code.visualstudio.com/Download下载.deb文件
sudo apt --fix-broken install ./文件名.deb
例如:
sudo apt --fix-broken install ./code_1.36.1-1562627527_amd64.deb
安装Anaconda
下载.sh文件
bash Anaconda文件名.sh
如:
bash Anaconda3-2019.03-Linux-x86_64.sh
一路yes搞定,这个很大,建议虚拟机增加一定固定分配
安装PyCharm
进入PyCharm官网,选择Community版,直接点击DOWNLOAD
解压文件,例如我的解压位置在/home/…/pycharm
cd /home/.../pycharm/pycharm-community-2019.1.3/bin
执行pycharm.sh命令文件,开始安装
sh ./pycharm.sh
出现Complete-Installation提示框,如果需要导入之前安装版本的配置的话,就选第一个,没有就选第二个。所以这里选第二个,直接点OK
执行pycharm.sh命令文件,开始安装
弹出 PyCharm Privary Policy Agreement,隐私政策协议框,点击Accept
OK完成,其他设置就按使用习惯设置
在PyCharm中使用Anaconda作为编译器
点击Craete New Project,创建一个新的项目
左边的列表选“Pure Python”
Interpreter选择安装的anaconda/bin/python
设置快捷方式
在在/usr/share/applications创建一个文件:pycharm.desktop
写入内容
[Desktop Entry]
Version=1.0
Type=Application
Name=Pycharm
Icon=/home/…/pycharm-community-2019.1.3/bin/pycharm.png (同安装路径)
Exec=sh /home/…/pycharm-community-2019.1.3/bin/pycharm.sh (同安装路径)
MimeType=application/x-py;
Name[en_US]=pycharm
安装MySQL
不用下载 系统自动下载
sudo apt-get update
sudo apt-get install mysql-server
一路y
配置MySQL
初始化配置
sudo mysql_secure_installation
回复系统
VALIDATE PASSWORD PLUGIN can be used to test passwords…
Press y|Y for Yes, any other key for No: N
Please set the password for root here…
New password: (输入密码)
Re-enter new password: == (重复输入)==
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them…
Remove anonymous users? (Press y|Y for Yes, any other key for No) : N
Normally, root should only be allowed to connect from
‘localhost’. This ensures that someone cannot guess at
the root password from the network…
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
By default, MySQL comes with a database named ‘test’ that
anyone can access…
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
安装python
实际Ubuntu自带,但是为了装新版本,按照以下步骤
sudo apt-get install git
安装依赖包
sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
安装pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
exec $SHELL -l
安装 python3.7.4
pyenv install 3.7.4 -v
对数据库进行更新
pyenv rehash
查看python版本
pyenv versions
设置全局python版本
pyenv global 3.7.4