You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu18+Python3.6.7下ModuleNotFoundError: No module named 'Crypto'求助

Fixing ModuleNotFoundError: No module named 'Crypto' on Ubuntu 18 with Python 3.6.7

Hey there, I’ve run into this exact issue a handful of times—let’s get it sorted out for you. The problem boils down to a common mix-up between the package name you need to install and the module name you import in your code. Here’s what to do step by step:

1. Uninstall conflicting/incorrect packages first

You mentioned installing Crypto and Pcrypto, but those aren’t the right packages for the Crypto module you’re trying to import. Let’s remove them to avoid conflicts:

pip3 uninstall Crypto Pcrypto -y

2. Install the correct package

The active, maintained package that provides the Crypto module is pycryptodome (it’s a drop-in replacement for the outdated pycrypto package, which no longer supports newer Python versions like 3.6). Install it with:

pip3 install pycryptodome

If you have multiple Python versions on your system

Ubuntu 18 might come with other Python versions pre-installed. To make sure the package is installed specifically for Python 3.6, use pip3.6 instead:

pip3.6 install pycryptodome

You can verify which Python version your pip3 targets by running:

pip3 --version

3. Verify the fix

Open a Python 3.6 shell and test the import:

import Crypto
print(Crypto.__version__)

If this outputs a version number (like 3.19.0 or similar), you’re good to go—your original code should now run without the ModuleNotFoundError.

Bonus check: Virtual environments

If you’re using a virtual environment for your project, make sure you’ve activated it before running the install commands. Packages installed outside the venv won’t be accessible to code running inside it.


内容的提问来源于stack exchange,提问作者Rasool Ahmed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:06:18