wba*_*dry 3 xubuntu windows-subsystem-for-linux 18.04
我可以将 WSL Ubuntu 18.04 上的默认 Python 3.6.5 更改为 3.7 吗?所以,当我检查python3 --version,我得到3.7.x这样我就可以使用该版本与PIP3为好。谢谢
以下是更改python3命令以指向您的python3.7版本的步骤(假设您已经安装了 3.7)。请根据您的环境需要调整路径
# 1 - Identify your location of `python3` using the `which` command
which python3
# returns something like
/usr/local/bin/python3
# 2 - Identify your location of `python3.7` using the `which` command
which python3.7
# returns something like
/usr/local/bin/python3.7
# 3 - Get directory listing of python3 folder (from 1 above)
# using grep to filter results containing 'python'
ll /usr/local/bin | grep -i python
# returns something like below - notice the arrow after python3
# the arrow indicates a symbolic link
lrwxrwxrwx 1 root root 18 Jul 4 2018 python3 -> /usr/bin/python3.6*
-rwxr-xr-x 2 root root 14777608 Nov 3 00:36 python3.7*
-rwxr-xr-x 2 root root 14777608 Nov 3 00:36 python3.7m*
-rwxr-xr-x 1 root root 3097 Nov 3 00:37 python3.7m-config*
-rwxr-xr-x 1 root root 4522328 Feb 22 17:24 python3x*
# 4 - Test creating a symbolic link using sudo to get root privileges
# enter password if/when prompted
sudo ln -s /usr/local/bin/python3.7 /usr/local/bin/test37
# 4 - verify test
test37 --version
# Desired output
Python 3.7.1
# 5 - remove test and python3
sudo rm /usr/local/bin/test37
sudo rm /usr/local/bin/python3
# 6 - creating python3 symbolic link using sudo to get root privileges
# enter password if/when prompted
sudo ln -s /usr/local/bin/python3.7 /usr/local/bin/python3
# 7 - verify
python3 --version
# Desired output
Python 3.7.1
Run Code Online (Sandbox Code Playgroud)
当然,pythonic 要做的是使用虚拟环境。
| 归档时间: |
|
| 查看次数: |
16318 次 |
| 最近记录: |