无法在WSL中安装或升级Python 3.10.8。

huangapple go评论73阅读模式
英文:

Can't install or upgrade Python 3.10.8 in WSL

问题

I need to specifically install Python 3.10.8 for school, but I can't seem to get a version higher than 3.10.6.

sudo apt-get install python3.10 just results in telling me that python3.10 is already the newest version (3.10.6-1~22.04.2ubuntu1.1).

I already did sudo apt update && sudo apt upgrade and this is what I got:

Failed to start apt-news.service: Unit apt-news.service not found.
Failed to start esm-cache.service: Unit esm-cache.service not found.
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB]
Fetched 108 kB in 1s (110 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

英文:

I need to specifically install Python 3.10.8 for school, but I can't seem to get a version higher than 3.10.6

sudo apt-get install python3.10 just result in telling me that python3.10 is already the newest version (3.10.6-1~22.04.2ubuntu1.1)

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3.10 is already the newest version (3.10.6-1~22.04.2ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I already did sudo apt update && sudo apt upgrade and this is what I got:

Failed to start apt-news.service: Unit apt-news.service not found.
Failed to start esm-cache.service: Unit esm-cache.service not found.
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease \[108 kB\]
Fetched 108 kB in 1s (110 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

得分: 1

Step 1: sudo apt update

Step 2: sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

Step 3: wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz

Step 4: tar -xf Python-3.10.8.tgz

Step 5: cd Python-3.10.8

Step 6: ./configure --enable-optimizations

Step 7: make -j $(nproc)

Step 9: sudo make altinstall

Verify if python 3.10.8 was installed: python3.10 --version

英文:

Step 1: sudo apt update

Step 2: sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

Step 3: wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz

Step 4: tar -xf Python-3.10.8.tgz

Step 5: cd Python-3.10.8

Step 6: ./configure --enable-optimizations

Step 7: make -j $(nproc)

Step 9: sudo make altinstall

Verify if python 3.10.8 was installed: python3.10 --version

答案2

得分: 0

WSL运行Ubuntu,而Ubuntu打包了Python。这意味着你可以安装Ubuntu打包的Python版本。他们不会打包每个次要版本。在WSL中,sudo apt-get install python3.10会安装Ubuntu打包的最新版本。

更一般地说,我怀疑你在学校不需要这么特定的版本。所有python3.10版本的功能都是相同的。除非你在测试Python中的特定问题,否则没有必要使用如此特定的包。

英文:

WSL runs Ubuntu which in turn packages Python. This means that it allows you to install Python versions that Ubuntu packages. They will not package every minor release. sudo apt-get install python3.10 installs the latest version packaged by Ubuntu in WSL.

More general, I doubt you need such a specific version for school. The features are the same for all python3.10 versions. Unless you are testing for specific issues within Python there is no need for such a specific package.

huangapple
  • 本文由 发表于 2023年6月26日 18:23:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76555779.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定