LoginSignup
0
0

Windows(x64) の Python 3.10 で PyCrypto を pip install

Last updated at Posted at 2023-07-18

注意

pycrypto は古いので pycryptodome を使いましょう

きっかけ

Windows(x64) の Python 3.10 で PyCrypto を pip install しようとすると

winrand.c のコンパイル中に inttypes.h で未定義エラーが出る

古い情報だと stdint.h を置き換えるとか inttypes.h を書き換えるとか出て来るが、もっと簡単に解決出来たのでメモ

結論

これだけ

set CL=-D"intmax_t=long long" -D"uintmax_t=unsigned long long" -DPY_SSIZE_T_CLEAN
pip install PyCrypto

参照

python3.6でpycryptoをインストールする際にはまったのでメモ
Windows(x64)でPython3.6.0(x64)にPyCryptoを入れるメモ

追加

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
によると

It sounds like the extension was not updated for python 3.10.

On 3.10 any module(s) that use the # variant when parsing arguments need to have a #define PY_SSIZE_T_CLEAN before including Python.h.

とのことで -DPY_SSIZE_T_CLEAN も追加する必要あり

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0