当前位置: 首页 > news >正文

Java、Python、NodeJS等开发环境安装及配置镜像加速到国内源

文章目录

  • Java
    • 1.Windows
      • 1.1 scoop方式安装JDK
    • 2.Linux
      • 2.1 apt方式安装JDK
        • 2.1.1 切换JDK
        • 2.1.2 验证版本
        • 2.1.3 原理
  • Python
    • 1.Windows
      • 1.1 scoop方式安装Python
      • 1.2 uv方式安装Python(推荐)
    • 2.Linux
      • 2.1 apt方式安装Python
        • 2.1.1 配置版本切换
        • 2.1.2 切换Python
        • 2.1.3 验证版本
      • 2.2 uv方式安装Python
    • 3.uv方式说明
      • 3.1 查看版本列表
      • 3.2 初始化项目
      • 3.3 添加依赖
      • 3.4 查看依赖
      • 3.5 同步依赖
  • NodeJS
    • 1.Windows
      • 1.1 scoop方式安装NodeJS
      • 1.2 nvm方式安装NodeJS(推荐)
    • 2.Linux
      • 2.1 nvm方式安装NodeJS(推荐)
    • 3.nvm方式说明
      • 3.1 安装版本
      • 3.2 查看版本列表
      • 3.3 切换版本
      • 3.4 验证版本
  • 配置国内源
    • 1.apt国内源
    • 2.pip国内源
    • 3.maven和gradle国内源

Java

从图中可以看出,下载8/11/17三个版本即可,其他版本按需下载。
在这里插入图片描述
从图中可以看出,除了Oracle外,Amazon和Eclipse Adoptium都挺好。
在这里插入图片描述

来源:https://newrelic.com/resources/report/2024-state-of-the-java-ecosystem

1.Windows

1.1 scoop方式安装JDK

scoop install corretto8-jdk corretto11-jdk corretto17-jdk 

2.Linux

2.1 apt方式安装JDK

apt install software-properties-common -y
apt install openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk -y
2.1.1 切换JDK
update-alternatives --config java
2.1.2 验证版本
java -version
2.1.3 原理
# 入口: /usr/bin/java -> /etc/alternatives/java*
ll /usr/bin/java# 切换: /etc/alternatives/java -> /usr/lib/jvm/java-21-openjdk-amd64/bin/java*
ll /etc/alternatives/java# 版本目录:/usr/lib/jvm
ll /usr/lib/jvm

Python

1.Windows

1.1 scoop方式安装Python

scoop install python38 python39 python310 python311 python312 python313 python314

1.2 uv方式安装Python(推荐)

scoop install uv

2.Linux

2.1 apt方式安装Python

apt install software-properties-common -y
add-apt-repository ppa:deadsnakes/ppa
apt install python{3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14} -y
2.1.1 配置版本切换
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 3
update-alternatives --install /usr/bin/python python /usr/bin/python3.9 4
update-alternatives --install /usr/bin/python python /usr/bin/python3.10 5
update-alternatives --install /usr/bin/python python /usr/bin/python3.11 6
update-alternatives --install /usr/bin/python python /usr/bin/python3.12 7
update-alternatives --install /usr/bin/python python /usr/bin/python3.13 8
update-alternatives --install /usr/bin/python python /usr/bin/python3.14 9
2.1.2 切换Python
update-alternatives --config python
2.1.3 验证版本
python --version

2.2 uv方式安装Python

apt install uv

3.uv方式说明

uv python install python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13 python3.14

3.1 查看版本列表

uv python list

3.2 初始化项目

uv init

3.3 添加依赖

uv add requests

3.4 查看依赖

uv tree

3.5 同步依赖

uv sync

NodeJS

1.Windows

1.1 scoop方式安装NodeJS

scoop install nodejs16 nodejs17 nodejs18 nodejs19 nodejs20 nodejs21 nodejs22 nodejs23

1.2 nvm方式安装NodeJS(推荐)

scoop install nvm bun

2.Linux

2.1 nvm方式安装NodeJS(推荐)

apt install nvm bun

3.nvm方式说明

3.1 安装版本

nvm install 23 
nvm install 22 
nvm install 21 
nvm install 20 
nvm install 19 
nvm install 18 
nvm install 17 
nvm install 16

3.2 查看版本列表

nvm list

3.3 切换版本

nvm use 23

3.4 验证版本

node -v

配置国内源

1.apt国内源

#--quiet
#-O file
wget -qO- https://gitee.com/duhongming/shell-script/raw/master/mirrors/apt-sources.sh | bash

2.pip国内源

  • 清华贼快(推荐)
    https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

  • 腾讯(备用)
    https://mirrors.cloud.tencent.com/pypi/simple/

  • 阿里贼慢还缺包
    https://developer.aliyun.com/mirror/pypi

  • 豆瓣重定向到腾讯
    https://pypi.doubanio.com/simple/

python -m pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple --upgrade pippip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple/
pip config set global.extra-index-url "https://mirrors.cloud.tencent.com/pypi/simple/ https://mirrors.aliyun.com/pypi/simple"
# 阿里有时候缺包
(venv) d@d:~/SourceCode/test-gpu$ pip3 install torch torchvision torchaudio --index-url https://developer.aliyun.com/mirror/pypi
Looking in indexes: https://developer.aliyun.com/mirror/pypi
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch# 豆瓣重定向到腾讯了
(venv) d@d:~/SourceCode/test-gpu$ pip3 install torch torchvision torchaudio --index-url https://pypi.doubanio.com/simple/
Looking in indexes: https://pypi.doubanio.com/simple/
Collecting torchDownloading https://mirrors.cloud.tencent.com/pypi/packages/d1/35/e8b2daf02ce933e4518e6f5682c72fd0ed66c15910ea1fb4168f442b71c4/torch-2.5.1-cp311-cp311-manylinux1_x86_64.whl (906.5 MB)	

3.maven和gradle国内源

参考:https://developer.aliyun.com/mvn/guide
.m2/settings.xml

<mirrors><mirror><id>aliyunmaven</id><mirrorOf>central</mirrorOf><name>阿里云公共仓库</name><url>https://maven.aliyun.com/repository/public</url></mirror><mirror><id>pentaho-public</id><name>Pentaho Public</name><mirrorOf>*</mirrorOf><url>http://nexus.pentaho.org/content/groups/omni/</url></mirror>
</mirrors>

\init.d\init.gradle

allprojects {repositories {mavenLocal()maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }mavenCentral()}buildscript { repositories { maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' }}}
}
http://www.xdnf.cn/news/381241.html

相关文章:

  • .Net HttpClient 使用准则
  • 【脑机接口临床】脑机接口手术的风险?脑机接口手术的应用场景?脑机接口手术如何实现偏瘫康复?
  • RT-Thread 深入系列 Part 6:高性能与低功耗优化策略
  • 智能库室联管联控系统|智能兵器室门禁管理系统
  • AI日报 · 2025年5月10日|OpenAI“Stargate”超级数据中心项目掀起美国各州争夺战
  • Dify+Ollama+Deepseek+BGE-M3来搭建本地知识库实操
  • C++ Vector深度易错点指南(临时抱佛脚)(基础用法;进阶;高级;实战)
  • PyTorch API 1 - 概述、数学运算、nn、实用工具、函数、张量
  • 【LangChain全景指南】构建下一代AI应用的开发框架
  • 数字相机的快门结构
  • not a genuine st device abort connection的问题
  • 实现三个采集板数据传送到一个显示屏的方案
  • null 的安全操作 vs 危险操作
  • Linux环境下基于Ncurses开发贪吃蛇小游戏
  • Java 内存模型 JMM
  • Edububtu 系统详解
  • Exploring Temporal Event Cues for Dense Video Captioning in Cyclic Co-Learning
  • 一个好用的快速学习的网站
  • python打卡day21
  • JavaScript基础-作用域概述
  • JDK10新特性
  • Apache Shiro 1.2.4 反序列化漏洞(CVE-2016-4437)
  • 二进制与十六进制数据转换:原理、实现与应用
  • DAY 21 常见的降维算法
  • 简述Web和HTTP
  • centos7.9上安装 freecad 指定安装位置
  • WinCC V7.2到V8.0与S71200/1500系列连接通讯教程以及避坑点
  • 码蹄集——向下取整(求立方根)、整理玩具、三角形斜边、完全平方数、个人所得税
  • MQTT协议介绍
  • 数据结构算法习题通关:树遍历 / 哈夫曼 / 拓扑 / 哈希 / Dijkstra 全解析