Linux Mint System Setup
Table of Contents
Git and GitKraken
$ sudo apt install git-all
Then I use which git
and find that this is installed in /usr/bin/git
.
Python
https://docs.anaconda.com/free/anaconda/install/linux/
If only need to add Conda path temporarily in this terminal run the following,
export PATH=~/anaconda3/bin:$PATH
To add the above permanently in ./bashrc
nano ~/.bashrc
, open the editorexport PATH="~/anaconda3/bin:$PATH"
, add this to the last linesource ~/.bashrc
reload the bash
I recommend not activating the conda environment (base) automatically when a terminal is created. This will cause unexpected problems when activating another environment later in vscode. For example, I installed an env at 3.9 version, but python --version
in this new env still returns the 3.11 version of base. This problem is solved when I turn off the auto activation.
Python Alias
To use python
as command alternative, need to add alias to .bashrc
, by adding this.
alias python=python3
Refer to this question.
Update on 2024/02, seems this is not needed anymore, python is linked already.
Hugo and Dependencies
Refer to https://wowchemy.com/docs/getting-started/install-hugo-extended/#linux
Going to use https://brew.sh/ to install. Remember to use the hints at last to add brew into the PATH!
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/yiming/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
With brew, install both Hugo (extended version by default) and go.
brew install hugo
brew install go
VS Code Setup
The goal is to activate virtual environment every time we start the terminal in a project, need to set the following in the settings.json
in .vscode
folder. The needed commands are placed in the .sh
file within the project root folder.
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"args": [
"--init-file",
"./quantbullet_dev_init.sh"
]
}
},
"terminal.integrated.defaultProfile.linux": "bash",
In my case these commands are,
source ~/.bashrc
conda activate quantbullet_dev
It seems calling bash directly will not load the ~/.bashrc
which makes conda not in PATH.
Useful Packages
Auto Complete
conda install -c conda-forge conda-bash-completion
Please refer to the package
Use .sh
to run a python file
Terminal runs the system python located in /usr/bin/python3
instead of the conda virtual environment I usually use. Therefore, packages need to be installed for this specific version.
Very likely, you have to install pip
first.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
/usr/bin/python3 get-pip.py
/usr/bin/python3 -m pip --version
Then, install the missing packages
/usr/bin/python3 -m pip install nbformat
Finally, create a <name>.sh
file and place python3 <python_file_name>.py
into it and change the execution mode to allow double click.
chmod +x myscript.sh
Useful Bash codes
Create shortcut
Create a shortcut, navigate to the target folder, and set the location to desktop
yiming@yiming-virtual-machine:~/dev$ ln -s $PWD ~/Desktop/
Do not activate Conda every time open a terminal.
conda config --set auto_activate_base false
Remove a package
sudo apt-get --purge remove hugo