[PYTHON] What to do if you get an Undefined error:'Module_six_moves_urllib_parse' object has no attribute'urlencode' on MacOS

I was a little addicted when I thought about trying Google Api, so I will write the cause and solution.

Cause

It seems that python, which is installed by default on Mac, already has a package called six under /System/Library/Frameworks/Python.framework/Versions/2.7/Extras. This was resolved before / Library / Python / 2.7 / site-packages, which was due to the package not being able to be updated.

Solution 1

Don't use the default python. If you are going to use python from now on, I think this solution is better.

Solution 2

I was able to solve it with the following command.

export PYTHONPATH=/Library/Python/2.7/site-packages

Reference URL

https://github.com/google/google-api-python-client/issues/100 http://stackoverflow.com/questions/29485741/unable-to-upgrade-python-six-package-in-mac-osx-10-10-2/29666702#29666702

Recommended Posts

What to do if you get an Undefined error:'Module_six_moves_urllib_parse' object has no attribute'urlencode' on MacOS
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if you get stuck during Anaconda installation on Linux
What to do if you get an error when trying to load mnist
What to do if you get an error when installing Dlib (Ubuntu)
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
What to do if you get an error when installing python with pyenv
What to do if you get an "unknown service" error from your gRPC server
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get `No kernel for language python found` in Hydrogen
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you get "coverage unknown" in Coveralls
What to do if you can't use WiFi on Linux
What to do if pip install mysqlclient fails on MacOS
What to do when you get an error saying "Name resolution temporarily failed" on linux
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do if you get a minus zero in Python
What to do if you get a UnicodeDecodeError with pip install
What to do if you get an error when vagrant up when you enable public_network or private_network on Vagrant + Arch Linux → Install netctl
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you get angry if you don't have libxml / xmlversion.h when installing lxml on CentOS
EC2 / Amazon Linux2: What to do if you get an "unable to execute'gcc': No such file or directory" error with pip install
What to do if you couldn't send an email to Yahoo with Python.
What to do if you try to push to git hub and get "fatal: The current branch develop / feature / discussion has no upstream branch."
What to do if you forget your login password on Manjaro Linux
What to do if you get lost in file reference with FileNotFoundError
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if you get a TypeError with numpy min, max
What to do if you get Could not fetch URL 443 with pip
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
What to do if you get a Permission denied (public key) error when trying to pull on Github
What to do if you can't pipenv shell
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
What to do if you get angry with swapon failed: Operation not permitted
What to do if CERTIFICATE_VERIFY_FAILED occurs when nltk.download () is done on macOS pyhon
What to do if you get "Python not configured." Using PyDev in Eclipse
What to do if an SSL connection error (ssl.SSLError: [SSL: DH_KEY_TOO_SMALL]) occurs on Ubuntu 20.04
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do if you can't pip install mysqlclient
What to do if SciPy installation fails on CentOS
What to do if "export" keeps appearing on terminal when trying to put Python on macOS
What to do if the Microsoft Store opens even if you run python on Windows
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if you run python in IntelliJ and end with an error
What to do if you are addicted to Windows character code
What to do if you can't sort files with subscripts
What to do if `pip install matplotlib` fails on Mac
What to do if you can't log in as root
What to do if Linux VLC can no longer rotate
What to do if you get a Cannot retrieve metalink for repository error in yum
ImportError: No module What to do when you are told
What to do if you lose your EC2 key pair
What to do if you get angry with'vertices' must be a 2D list ... in matplotlib arrow
CommandNotFoundError: Your shell has not been properly configured to use What to do if you get'conda activate'
[Django] What to do if the model you want to create has a large number of fields
What to do if you get a must override `get_config` error when trying to model.save in Keras