简体   繁体   English

我无法使用 pip3 安装 python 包

[英]I cannot install python packages using pip3

I have installed pip3 successfully but whenever i try to install a package it comes up with this error(on macos high sierra terminal):我已成功安装 pip3,但每当我尝试安装 package 时,都会出现此错误(在 macos high sierra 终端上):

    libsuinput/src/suinput.c:25:10: fatal error: 'linux/limits.h' file not found
#include <linux/limits.h>
         ^
1 error generated.
error: command 'gcc' failed with exit status 1

and

ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_4/bc_4xmsn63vb8kt8t5_g1wqm0000gn/T/pip-install-hby05qne/python-uinput/setup.py'"'"'; __file__='"'"'/private/var/folders/_4/bc_4xmsn63vb8kt8t5_g1wqm0000gn/T/pip-install-hby05qne/python-uinput/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/_4/bc_4xmsn63vb8kt8t5_g1wqm0000gn/T/pip-record-xlhm8d89/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Can anyone help?任何人都可以帮忙吗?

Edit: it returns the same error using normal pip编辑:它使用普通pip返回相同的错误

Solved.解决了。 Package i was trying to install was not compatible with MacOS.我尝试安装的 Package 与 MacOS 不兼容。

Python 2 is installed by default on Apple computers(check by $ python --version ), but if you need Python 3 then you can use following steps- Python 2 默认安装在苹果电脑上(检查$ python --version ),但如果你需要 Python 3 那么你可以使用以下步骤 -

  1. Install Xcode and Homebrew.安装 Xcode 和 Homebrew。 For Xcode do this- $ xcode-select --install .对于 Xcode 执行此操作 - $ xcode-select --install Then install homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"然后安装 homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

To confirm Homebrew installed correctly, run this command: $ brew doctor要确认 Homebrew 安装正确,请运行以下命令: $ brew doctor

  1. Install Python 3. Do this - $ brew install python3安装 Python 3. 执行此操作 - $ brew install python3
  2. Lastly, check your python version by $ python3 --version最后,通过$ python3 --version检查您的 python 版本

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM