简体   繁体   English

为什么在尝试使用 pip 安装枕头时出现错误“[Errno 42] 非法字节序列”?

[英]Why do I get an error "[Errno 42] Illegal byte sequence" when trying to install pillow using pip?

I want to install pillow, but when I run pip install pillow in the cmd I get the following message:我想安装枕头,但是当我在 cmd 中运行pip install pillow时,我收到以下消息:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pillow
  Downloading https://files.pythonhosted.org/packages/5e/b6/8960697526a79bd1cb4520293078be3a10d725f23f20abbee298ebdeaabd/Pillow-6.2.2-cp27-cp27m-win_amd64.whl (1.9MB)
     |ERROR: Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence

WARNING: You are using pip version 19.2.3, however version 20.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Python 3.8.2 is already installed on my computer and I added it to PATH. Python 3.8.2 已经安装在我的电脑上,我将它添加到 PATH 中。

I also ran python -m pip install --upgrade pip and nothing has changed.我还运行了python -m pip install --upgrade pip并且没有任何改变。

What is the problem?问题是什么? Do I need to update the Python version?需要更新Python版本吗?

Installation using third party PPA repository使用第三方 PPA 存储库安装

Step 1: First install the Ubuntu software properties package if it's not already installed on your system.第 1 步:如果您的系统上尚未安装 Ubuntu 软件属性 package,请先安装它。

$ sudo apt update

$ sudo apt install software-properties-common

Step 2: After that run the commands to add the PPA.第 2 步:之后运行命令添加 PPA。

$ sudo add-apt-repository ppa:deadsnakes/ppa

Step 3: Finally, run below to install Python 3.8第三步:最后运行下面安装Python 3.8

$ sudo apt update
$ sudo apt install python3.8

You can check as below:您可以检查如下:

$ python3 --version

Python 3.8.1 Python 3.8.1

OK done. OK完成。

Don't use the pip , pip3 , etc. scripts ever.永远不要使用pippip3等脚本。 Instead always prefer the more explicit and surefire way of calling pip 's executable module for a specific instance of the Python interpreter, for example:相反,总是更喜欢为 Python 解释器的特定实例调用pip的可执行模块的更明确和可靠的方式,例如:

path/to/pythonX.Y -m pip install Pillow

References:参考:

  1. Check if Python3 is correctly installed by, for example, running python3 -V in the command-line (this will show you the installed version)检查 Python3 是否正确安装,例如,在命令行中运行python3 -V (这将显示已安装的版本)

    • This should show something like Python 3.8...这应该显示类似Python 3.8...
    • If you get an error here, like it is an unknown command, something probably went wrong during the installation...如果你在这里得到一个错误,就像它是一个未知的命令,安装过程中可能出了问题......
  2. Run pip3 install pillow to install pillow (Python 3)运行pip3 install pillow以安装枕头(Python 3)

Kindly download it at Python official website .请到Python官网下载。

There is an option to update your version during the installation which is very useful.有一个选项可以在安装过程中更新您的版本,这非常有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试使用“pip install Pillow”安装枕头,但出现错误 - I am trying to install pillow using 'pip install Pillow' but I am getting error 我正在尝试使用“pip”安装枕头 - I am trying to install pillow using 'pip' 当 pip install 'pyrebase' 时,我收到错误 'UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 500:非法多字节序列' - When pip install 'pyrebase', I got error ' UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 500: illegal multibyte sequence' 为什么在 Mac 上尝试安装“pip install ball”时总是出现错误 - Why do I keep getting an error when trying to install "pip install ball" on Mac 为什么在Ubuntu上安装Pillow 3.0.0时出错? - Why do I get an error when installing Pillow 3.0.0 on Ubuntu? 当我尝试通过pip安装BeautifulSoup时为什么会出现此错误? - Why do I get this error when I try to pip install BeautifulSoup? 当我尝试执行 pip 安装时出现错误 - I get and error when I try to do pip install 为什么使用 pip 安装 package 后仍然出现“找不到模块”错误? - Why do I still get the “module not found” error even after having installed the package using pip install? 使用 PIP 在 Flatpak 中安装 Pillow - Using PIP to install Pillow in a Flatpak 为什么在运行“pip install -r requirements.txt”时出现错误“找不到满足要求 scipy==1.5.3 的版本”? - Why do I get error “Could not find a version that satisfies the requirement scipy==1.5.3” when running “pip install -r requirements.txt”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM