Hi I upgraded my Ubuntu to 16.04 but whenever I try to run a Python program or pip install (both Python 2.7 or Python 3.5) I get the following error:
ImportError: No module named 'encodings' 14 2 Answers
From the comments, it looks like you were trying to use pip3 inside a virtualenv that is set up for Python 2. Note that running virtualenv venv creates a virtualenv named venv for Python 2 by default on Ubuntu if you don't specify the Python version explicitly.
In any case, if you want to create a virtualenv for Python 2, run:
virtualenv venv # create virtualenv named venv for Python 2If you want to create a virtualenv for Python 3, run:
virtualenv venv -p python3 # create virtualenv named venv for Python 3In both cases, after you have activated the virtualenv by running source venv/bin/activate, you just need to call pip to install Python packages; this still applies for a virtualenv created for Python 3 because pip already knows what Python version you are using, so don't call pip3.
I used dpkg -S <missing file> to figure out which package to reinstall...
Then I ran (example):
sudo apt install --reinstall libpython2.7-stdlib libpython2.7-minimal