I\'m a newbie and I needed the pySerial and feedparser module for my projects. I\'m running Mountain lion.
I followed the following tutorial so that I could upgrade
how did you install easy_install/pip? make sure that you installed it for the upgraded version of python. what could have happened here is that the old (default) python install might be linked to your pip install. you might wanna try running the default version and importing the newly installed modules.
For the sake of anyone also using visual studio from a windows environment:
I realized that I could see my module installed when i ran pip install
py pip install [moduleName]
py pip list
However debugging in visual studio was getting "module not found". Oddly, i was successfully running import [moduleName]
when i ran the interpreter in powershell.
Reason:
visual studio was using the wrong interpreter at:
C:\Users\[username]\AppData\Local\Programs\Python\Python37\
What I REALLY wanted was visual studio to use the virtualenv that i setup for my project. To do this, right click Python Environments in "solution explorer", select Add Virtual Environment..., and then select the folder where you created your virtual environment. Then, under project settings, under the General tab, select your virtual environment in the dropdown.
Now visual studio should be using the same interpreter and everything should play nice!
No other solutions were working for me, so I tried:
pip uninstall <module> && pip install <module>
And that resolved it for me. Your mileage may vary.
For me the problem was that I had weird configuration settings in file pydistutils.cfg
Try running
rm ~/.pydistutils.cfg
As a quick workaround, and assuming that you are on a bash-like terminal (Linux/OSX), you can try to export the PYTHONPATH environment variable:
export PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages"
For Python 2.7
If your python
and pip
binaries are from different versions, modules installed using pip will not be available to python.
Steps to resolve:
pip
and python
.readlink $(which pip)
../Cellar/python@2/2.7.15_1/bin/pip
readlink $(which python)
/usr/local/bin/python3 <-- another symlink
readlink /usr/local/bin/python3
../Cellar/python/3.7.2/bin/python3
Here you can see an obvious mismatch between the versions 2.7.15_1
and 3.7.2
in my case.
ln -is /usr/local/Cellar/python/3.7.2/bin/pip3 $(which pip)
The -i
flag promts you to overwrite if the target exists.
That should do the trick.