Reputation: 89
I try to launch a python file but it returns me the error:
File "/usr/local/lib/python3.10/ctypes/init.py", line 8, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes'
The only solution I found on the web is to:
sudo dnf install libffi-dev
I tried but it doesn't work either, although it seems to work for everyone. If anyone has a lead...
Upvotes: 7
Views: 21713
Reputation: 612
If you install Python3.7 from file, then reinstall it.
sudo apt install libffi-dev
cd Python-3.11.0a7
./configure --enable-optimizations
sudo make install
I had the similar error while using Python3.7 with venv and fixed as above.
Upvotes: 5
Reputation: 485
You need to reinstall python:
pyenv uninstall <your_version>
sudo apt install libffi-dev
pyenv install <your_version>
pyenv global <your_version>
I had the same error and it helped.
Upvotes: 6