吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1380|回复: 12
收起左侧

[求助] python 如何安装leveldb

  [复制链接]
zhi_huo 发表于 2022-10-3 12:38
25吾爱币
需要import leveldb
但是pip install leveldb报错:
[PowerShell] 纯文本查看 复制代码
PS C:\Users\ZhiHu> pip install leveldbCollecting leveldb
  Using cached leveldb-0.201.tar.gz (236 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      Don't know how to compile leveldb for Windows!
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

最佳答案

查看完整内容

我看了下源码,发现它不支持Windows [mw_shl_code=python,true]if system == 'Darwin': extra_compile_args = common_flags + [ '-DOS_MACOSX', '-DLEVELDB_PLATFORM_POSIX', '-Wno-error=unused-command-line-argument-hard-error-in-future', ] elif system == 'Linux': extra_compile_args = common_flags + [ '-pthread', '-Wall', '-DOS_LINUX', ...

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

hrpzcf 发表于 2022-10-3 12:38
zhi_huo 发表于 2022-10-3 12:50
已经安装过了wheel

我看了下源码,发现它不支持Windows
[Python] 纯文本查看 复制代码
if system == 'Darwin':
    extra_compile_args = common_flags + [
        '-DOS_MACOSX',
        '-DLEVELDB_PLATFORM_POSIX',
        '-Wno-error=unused-command-line-argument-hard-error-in-future',
    ]
elif system == 'Linux':
    extra_compile_args = common_flags + [
        '-pthread',
        '-Wall',
        '-DOS_LINUX',
        '-DLEVELDB_PLATFORM_POSIX',
    ]
else:
    sys.stderr.write("Don't know how to compile leveldb for %s!\n" % system)
    sys.exit(1)
hrpzcf 发表于 2022-10-3 12:49
先pip install wheel setuptools
在安装你说的那个包,试试看能不能安装
 楼主| zhi_huo 发表于 2022-10-3 12:50
hrpzcf 发表于 2022-10-3 12:49
先pip install wheel setuptools
在安装你说的那个包,试试看能不能安装

已经安装过了wheel
s1986q 发表于 2022-10-3 13:01
这个需要c++编译环境的。
 楼主| zhi_huo 发表于 2022-10-3 13:09
s1986q 发表于 2022-10-3 13:01
这个需要c++编译环境的。

我安装了visual studio 的桌面c++开发环境(默认)
但还是不行
 楼主| zhi_huo 发表于 2022-10-3 13:11
s1986q 发表于 2022-10-3 13:01
这个需要c++编译环境的。

我只安装了环境,之后应该怎么做?
hrpzcf 发表于 2022-10-3 13:11
zhi_huo 发表于 2022-10-3 13:09
我安装了visual studio 的桌面c++开发环境(默认)
但还是不行

因为它编译脚本里写着"不知道如何为Windows编译"
 楼主| zhi_huo 发表于 2022-10-3 13:18
hrpzcf 发表于 2022-10-3 13:11
因为它编译脚本里写着"不知道如何为Windows编译"

我只能开个Linux虚拟机,对吧?
hrpzcf 发表于 2022-10-3 13:35
本帖最后由 hrpzcf 于 2022-10-3 13:42 编辑
zhi_huo 发表于 2022-10-3 13:18
我只能开个Linux虚拟机,对吧?

对。但是它pypi页面上还标了 Python 3.3,不知道是只支持到Python 3.3还是啥意思,最后一次更新是2019.12.9,而且好像不是 LevelDB 官方维护的 Python 绑定,如果有别的替代的话还是用别的吧
屏幕截图 2022-10-03 133255.png
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-25 16:07

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表