问题描述:

I am having some trouble understanding and fixing this issue in my python installation. Hopefully someone can help me wrap my head around this..?

Python itself runs (ie: the python command produces the expected REPL). When I try to use pip (pip search, pip install, ...) I get the following traceback (apparently there are core modules missing..?!):

Traceback (most recent call last):

File "/usr/bin/pip", line 6, in <module>

from pkg_resources import load_entry_point

File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 26, in <module>

import zipfile

File "/usr/lib/python3.6/zipfile.py", line 13, in <module>

import shutil

File "/usr/lib/python3.6/shutil.py", line 13, in <module>

import tarfile

File "/usr/lib/python3.6/tarfile.py", line 48, in <module>

import struct

File "/usr/lib/python3.6/struct.py", line 13, in <module>

from _struct import *

ModuleNotFoundError: No module named '_struct'

But how can that be?

I've tried reinstalling python (through pacman) to no avail. Ditto for python-pip.

Perhaps the exception is misleading..?

What's with the core module struct importing a private version of itself that doesn't exist?! How could such an omission exist? Everyone's python 3.6 would be broken.. no?

sys.path = ['', '/code/scott/Py/Path', '/usr/lib/python3.6/Tools/scripts', '/usr/lib/python3.6/site-packages', '/usr/lib/python3.6', '/usr/lib/python3.6/lib/python36.zip', '/usr/lib/python3.6/lib/python3.6', '/usr/lib/python3.6/lib/python3.6/lib-dynload']

Python version:

Python 3.6.0 (default, Jan 16 2017, 12:12:55) [GCC 6.3.1 20170109] on

linux

Pip version: 9.0.1-2 (Built: 24/12/2016 06:47:25)

OS: Manjaro Linux (Arch Linux + KDE)

Kernel version: 4.9.9-1-MANJARO (from KInfocentre)

python and pip (python-pip) installed through pacman (arch package manager) via the commands:

sudo pacman -S python

sudo pacman -S python-pip

Ah! Importing struct from inside python produces the same error:

import struct

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File "/usr/lib/python3.6/struct.py", line 13, in <module>

from _struct import *

ModuleNotFoundError: No module named '_struct'

...What information would be helpful? I can add to my question..

相关阅读:
Top