Skip to Main Content

Programming Language Related Records

Python

# Install pip
curl https://bootstrap.pypa.io/get-pip.py-o get-pip.py
sudo python pyget-pip.py
# view version
pip --version

  • Basic processes
Create a virtual environment under the project root:`python -m venv venv`
Activates the virtual environment:
   - Linux/macOS: `source venv/bin/activate`
   - Windows: `venv\Scripts\activate`
Make sure all:`pip install -r requirements. xt`
    - If installation fails, manually install dependency on:`pips install requests`
    - update requirements.txt:`pipeze > requirements. xt`
Run:`python main.py`
Visit:`http://localhost:50000`
exit virtual environment:`deactivate`

anaconda

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh   # Miniconda(轻量版,推荐)  
# 或(若需完整版Anaconda)  
# wget https://repo.anaconda.com/archive/Anaconda3-latest-Linux-x86_64.sh 
# 运行安装脚本  
bash Miniconda3-latest-Linux-x86_64.sh  

# 按照提示进行安装(默认即可, 最后一步, 选择yes, 用于更新.bashrc或.zshrc文件)
# You can undo this by running `conda init --reverse $SHELL`? [yes|no]
# [no] >>> yes

# 激活Conda
source ~/.bashrc  # 若使用zsh,执行`source ~/.zshrc`  
# 验证安装
conda --version  # 输出版本号即成功  
# (可选)配置国内镜像源(加速下载)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/   
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/   
conda config --set show_channel_urls yes  

# Create virtual environment
conda creation -n myenv python=3.8
# Activate virtual environment
conda activation myenv
# Install dependency
pip install -r requirements. xt
# Run
python main.py
# Exit Virtual Environment
conda deactivate

java

# View installed JDK
/usr/libexec/java_home -V

# or
girls /Library/Java/VirtualMachines/

# # result in xml parsing anomalies, rendering log xml file parsing exception and excluding xpp3dependency
./gradlew :support-service:depends--configuration runtimeClassath -Dorg.gradle.java.home=/Users/fa/Library/Java/VirtualMachines/corretto-17. 15/Contents/Home | grep -i xpp

# Global exclusions (recommended)
# # // Root project build.gradle
# allprojects LO
# configurations. llLO
# exclude group: 'xpp3', module: 'xpp3'
# }
#

# First identify which dependency was introduced to XPP:
. gradlew : support-service: dependencyInsight --configuration runtimeClasspath -Dorg.gradle.java.home=/Users/fa/Library/Java/Java VirtualMachines/corretto-17.0/Contents/Home -dependent xpp3
# and then exclude:
# implementation ('org.springframe) for a specific purpose. Poot:spring-boot-starter-web') LO
# exclude group: 'xpp3', module: 'xpp3'
# }

# configurations. llLO
# exclude group: 'xpp3'
# exclude module: 'xpp3'
# }

gradlew clean

rm -rf ~/.gradle/caches
# View log-related dependencies
./gradlew :support-service:dependencies --configuration runtimeClasspath -Dorg.gradle.java.home=/Users/fa/Library/Java/VirtualMachines/corretto-17.0.15/Contents/Home | grep -i "log\|slf4j"

# Check if there is a conflict of dependency
# gradlew dependencies --configuration runtimeClasspath | grep -i "conflict\|duplicate"
./gradlew :support-service:dependagencies --configuration runtimeClasspath -Dorg.gradle.java.home=/Users/fa/Library/ Java VirtualMachines/corretto-17.0.15/Contents/Home | grep -i "conflict\|duplicate"

# Checking OCR dependencies on which log libraries
./gradlew :support-service:dependenceInsight --configuration runtimeClasspaath --dependent com.aliyun:ocr_api20210707:3.1.3 -Dorg.gradle.java.home=/users/fa/Library/Java/VirtualMachines/corretto-17.015/Contents/Home