Python3 install pip Tip ModuleNotFoundError: No module named 'distutils.util'
Environmental ubutun14, python python3.6 version is appearing today ModuleNotFoundError when installing Pip:. No module named 'distutils.util '.
Steps are as follows:
lxhui@zpt:~/python3_lib$ python3 -V Python 3.6.5
We can be judged by the following command has been installed:
pip --version
If not already installed, you can use the following methods to install:
$ Curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # script to download and install $ sudo python3 get-pip.py # Note that I run the install script environment variable is python3, everyone probably python
Note: Which version of Python run the installation script, pip was linked to which version, if it is Python3 execute the following command:
Sudo python3 $ GET - PIP . Py # run the installation script.
Generally pip corresponds Python 2.7, pip3 corresponds Python 3.x. Here I was python3.6.
The above tips can not find the module, so I try
sudo apt-get install python-pip
The problem persists, the Internet was said to be environmental variables, in fact, is not the final perfect solution is to install the following modules:
sudo apt-get install python3-distutils
My presence:
lxhui@zpt:~/python3_lib$ sudo apt-get install python3-distutils E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
The reason is that I had to perform in front of apt-get command, apt still running, remove the lock file:
sudo rm /var/lib/dpkg/lock
Install it again:
Installation pip,
sudo python3 get-pip.py
Wait for the installation was successful:
You can upgrade pip:
sudo pip install -U pip
Tip permissions issue:
If this upgrade command problems, you can use the following command:
sudo easy_install --upgrade pip
OK, this issue completely resolved.
Environmental ubutun14, python python3.6 version is appearing today ModuleNotFoundError when installing Pip:. No module named 'distutils.util '.
Steps are as follows:
lxhui@zpt:~/python3_lib$ python3 -V Python 3.6.5
我们可以通过以下命令来判断是否已安装:
pip --version
如果还未安装,则可以使用以下方法来安装:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 下载安装脚本 $ sudo python3 get-pip.py # 运行安装脚本 注意这里我的环境变量是python3,大家的可能是python
注意:用哪个版本的 Python 运行安装脚本,pip 就被关联到哪个版本,如果是 Python3 则执行以下命令:
$ sudo python3 get-pip.py # 运行安装脚本。
一般情况 pip 对应的是 Python 2.7,pip3 对应的是 Python 3.x。此处我的是python3.6。
上面提示找不到模块,于是我尝试
sudo apt-get install python-pip
问题依旧,网上有人说是环境变量的问题,其实不是,最终完美解决是安装下面的模块:
sudo apt-get install python3-distutils
我的出现:
lxhui@zpt:~/python3_lib$ sudo apt-get install python3-distutils E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
原因是我前面执行过apt-get 命令,apt还在运行,移除锁文件:
sudo rm /var/lib/dpkg/lock
再次安装:
安装pip,
sudo python3 get-pip.py
等待安装成功:
可以升级pip:
sudo pip install -U pip
提示权限问题:
如果这个升级命令出现问题 ,可以使用以下命令:
sudo easy_install --upgrade pip
OK,到此问题彻底解决。