安装 python 3.7 及其软件包时出现问题

安装 python 3.7 及其软件包时出现问题

我会请就这个问题提出建议

  • 最佳安装方式python 3.7为默认安装python
  • 安装软件包的最佳方法

我对命令行还很陌生。我正在参加数据科学训练营并在 Ubuntu 上尝试一些东西,但是,我们正在学习的许多命令似乎没有安装(包括安装程序...)。

例如python

iboopedu@CODE1026:/mnt/c/Users/shane$ python

Command 'python' not found, but can be installed with:

sudo apt install python3
sudo apt install python
sudo apt install python-minimal

You also have python3 installed, you can run 'python3' instead.

例如pip

iboopedu@CODE1026:/mnt/c/Users/shane$ pip install python

Command 'pip' not found, but can be installed with:

sudo apt install python-pip

iboopedu@CODE1026:/mnt/c/Users/shane$ sudo apt install python-pip
[sudo] password for iboopedu:
Sorry, try again.
[sudo] password for iboopedu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip

例如virtualenv

iboopedu@CODE1026:/mnt/c/Users/shane$ virtualenv test

Command 'virtualenv' not found, but can be installed with:

sudo apt install virtualenv

iboopedu@CODE1026:/mnt/c/Users/shane$ sudo apt install virtualenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package virtualenv

故障排除

我还使用了 和Mac,并且Terminal所有上述命令都可以正常工作,无需任何特殊设置或安装,python从运行Anaconda

鉴于此,我尝试复制pythonAnaconda开始的运行Ubuntu

我尝试了以下操作但没有成功:

  1. 手动更改PATH为包括Anaconda's python.exe
iboopedu@CODE1026:/mnt/c/Users/shane/Documents$ echo $PATH
/mnt/c/Users/shane:/mnt/c/Users/shane/Anaconda3/Library/bin:/mnt/c/Users/shane/Anaconda3/Scripts:/mnt/c/Users/shane/Anaconda3:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2018.817.0_x64__79rhkp1fndgsc:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/Windows Live/Shared:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/GNU/GnuPG/pub:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Users/shane/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/shane/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin
  1. 重新安装Anaconda并自动将 Anaconda 添加到PATH
iboopedu@CODE1026:/mnt/c/Users/shane$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2018.817.0_x64__79rhkp1fndgsc:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/Windows Live/Shared:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/GNU/GnuPG/pub:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Users/shane/Anaconda3:/mnt/c/Users/shane/Anaconda3/Library/mingw-w64/bin:/mnt/c/Users/shane/Anaconda3/Library/bin:/mnt/c/Users/shane/Anaconda3/Scripts:/mnt/c/Users/shane/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/shane/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin

我就是这种情况,希望有人能帮忙!提前谢谢。

相关内容