PS C:\Users\riko> pip --version
pip 24.3.1 from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip (python 3.13)
PS C:\Users\riko> pip cache purge
Files removed: 158
PS C:\Users\riko> pip install beancount
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
Collecting beancount
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/bb/0d/4bfa4e10c1dac42a8cf4bf43a7867b32b7779ff44272639b765a04b8553e/beancount-3.0.0.tar.gz (1.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 7.4 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
+ meson setup C:\Users\riko\AppData\Local\Temp\pip-install-matoi8w9\beancount_9d85d59e28b14d50aa8b6b41ed5c448e C:\Users\riko\AppData\Local\Temp\pip-install-matoi8w9\beancount_9d85d59e28b14d50aa8b6b41ed5c448e\.mesonpy-kysma_fl -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\riko\AppData\Local\Temp\pip-install-matoi8w9\beancount_9d85d59e28b14d50aa8b6b41ed5c448e\.mesonpy-kysma_fl\meson-python-native-file.ini
The Meson build system
Version: 1.6.1
Source dir: C:\Users\riko\AppData\Local\Temp\pip-install-matoi8w9\beancount_9d85d59e28b14d50aa8b6b41ed5c448e
Build dir: C:\Users\riko\AppData\Local\Temp\pip-install-matoi8w9\beancount_9d85d59e28b14d50aa8b6b41ed5c448e\.mesonpy-kysma_fl
Build type: native build
Project name: beancount
Project version: 3.0.0
WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]
The following exception(s) were encountered:
Running `icl ""` gave "[WinError 2] 系统找不到指定的文件。"
Running `cl /?` gave "[WinError 2] 系统找不到指定的文件。"
Running `cc --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `gcc --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `clang --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `clang-cl /?` gave "[WinError 2] 系统找不到指定的文件。"
Running `pgcc --version` gave "[WinError 2] 系统找不到指定的文件。"
A full log can be found at C:\Users\riko\AppData\Local\Temp\pip-install-matoi8w9\beancount_9d85d59e28b14d50aa8b6b41ed5c448e\.mesonpy-kysma_fl\meson-logs\meson-log.txt
[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版的beancount,安装过Visual Studio,公司电脑没有。
编辑:检查了下pypi界面的文件,原来是因为我安装的Python版本太新(3.13),beancount的whl并没有编译这版本的。退回到3.12就可以了🙏