Upgrading Python3 package is always a big pain for me. Every time I upgrade from one version, e.g. 3.7.0, to another, e.g. 3.7.1, my python script loses access to my /usr/local/lib/python3.7/site-packages/ folder. I have to revert back to the previous version, i.e. 3.7.0, to allow my script have access to this folder again.

My question is simple. How to upgrade Python3 while maintaining access to the above lib folder. Should I create a /usr/local/lib/python3.7.1/ folder? I doubt since we are still under the numbering 3.7 for Python.

There has to be a mean to upgrade Python subversions without breaking access to the lib.

Here's the kind of error I receive:

Traceback (most recent call last):
File "./script.py", line 20, in <module>
import urllib3
ModuleNotFoundError: No module named 'urllib3'

But I have urllib3 in /usr/local/lib/python3.7/site-packages/ So why reverting back to previous 3.7.0 would reenable lib access?

  • You probably will enjoy virtualenv. docs.python-guide.org/dev/virtualenvs
    – Michael D.
    Nov 19, 2018 at 13:03
  • What OS are you on, what is the upgrade command you are using, what is the exec command (python script.py or ./script.py with a shebang etc)?
    – hoefling
    Nov 23, 2018 at 12:37
  • OS X 10.11.6 – brew upgrade python3 – Script comes from here (ProxHTTPSProxyMII for HTTPS filtering) – Command: ./ProxHTTPSProxy.py
    – Faxopita
    Nov 24, 2018 at 13:05
  • I followed the above virtualenvs guide and can even run the Python script as follows: pipenv run python ./ProxHTTPSProxy.py Unfortunately, when I upgrade Python from 3.7.0 to 3.7.1 I've got plenty of error messages that relate to pipenv and my script no longer runs. Why is it so difficult to upgrade Python without breaking everything? I'm exhausted by so much complications and hours of staring at my screen in an attempt to solve this and for doing a simple thing as upgrading Pyhon itself!
    – Faxopita
    Dec 2, 2018 at 15:29


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.