【问题标题】:Why doesnt pip install bitarray work for me? [duplicate]为什么 pip install bitarray 不适合我? [复制]
【发布时间】:2021-08-24 12:06:03
【问题描述】:

所以我尝试使用pip install bitarray,但这会导致错误,即使我也无法真正理解。我已经在使用其他几个软件包时遇到了这个问题,今天我安装了一个虚拟环境并尝试再次编码。我试图在这个 venv 之外安装包,但我得到了同样的错误。

Collecting bitarray
Using cached bitarray-2.1.0.tar.gz (71 kB)
Using legacy 'setup.py install' for bitarray, since package 'wheel' is not installed.
Installing collected packages: bitarray
    Running setup.py install for bitarray ... error
    ERROR: Command errored out with exit status 1:
     command: 'd:\workspace\work_env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\desup\\Acal\\Temp\\pip-install-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"'; __file__='"'"'C:\\Users\\desup\\AppData\\Local\\Temp\ll-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__se io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(cod_, '"'"'exec'"'"'))' install --record 'C:\Users\desup\AppData\Local\Temp\pip-record-c9vvo7_u\install-record.txt' --single-version-externally-manpile --install-headers 'd:\workspace\work_env\include\site\python3.9\bitarray'
         cwd: C:\Users\desup\AppData\Local\Temp\pip-install-zbskwcko\bitarray_19f857dc240346679ec2269bbe2d36b2\
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\bitarray
    copying bitarray\test_bitarray.py -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\test_util.py -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\__init__.py -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\bitarray.h -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\pythoncapi_compat.h -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\test_data.pickle -> build\lib.win-amd64-3.9\bitarray
    running build_ext
    building 'bitarray._bitarray' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\workspace\work_env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\desup\\AppData\\Local\\Temp\\pip-install-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"'; __file__='"'"'C:\\Users\\desup\\AppData\\Local\\Temp\\pip-install-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\desup\AppData\Local\Temp\pip-record-c9vvo7_u\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\workspace\work_env\include\site\python3.9\bitarray' Check the logs for full command output.```

【问题讨论】:

  • 请将控制台输出格式化为代码。当前的格式使其难以辨认
  • 错误:需要 Microsoft Visual C++ 14.0。使用“Visual Studio 构建工具”获取它:visualstudio.microsoft.com/downloads

标签: python pip


【解决方案1】:

这部分

需要 Microsoft Visual C++ 14.0。使用“构建工具 Visual Studio”:https://visualstudio.microsoft.com/downloads/

建议您在安装 bitarray 之前安装 Microsoft Visual C++ 14.0。 bitarray's PyPI page 提示您在安装 bitarray 之前需要工作的 C 编译器

【讨论】:

  • 谢谢!错误消息现在已经消失了,但我仍然在“问题”下收到通知Import "bitarray" could not be resolved Pylance(reportMissingImports) [2, 8] 更新:我必须将 python 解释器从 venv 更改为 python.exe,这样才能正常工作!
猜你喜欢
  • 2019-07-03
  • 1970-01-01
  • 2021-08-23
  • 1970-01-01
  • 2020-11-22
  • 1970-01-01
  • 2020-02-28
  • 2019-02-07
  • 2018-12-22
相关资源
最近更新 更多