1

My installation of Python3 is failing. I believe this might be due to my $PYTHONPATH which needs to be cleaned up. How can I edit the PYTHONPATH (I do not know where it resides).

What I get when I run python3:

➜  ~ python3
Failed to import the site module
ImportError: bad magic number in 'site': b'\x03\xf3\r\n'

$PYTHONPATH

➜  ~  python -c "import sys; print '\n'.join(sys.path)"

/Users/asselinpaul/Dropbox/Coding/Github/sathotwordspy/src/python-firebase
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython-0.20-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/python_yelp_v2-0.2-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pysnap-0.1-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pysnapchat-0.1-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docopt-0.6.1-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytrth-1.0-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/egenix_mx_base-3.2.8-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/suds-0.4-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.0rc1_19_g520170d-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.7.3-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/yolk-0.4.3-py2.7.egg
/Library/Python/2.7/site-packages/readline-6.2.4.1-py2.7-macosx-10.7-intel.egg
/Library/Python/2.7/site-packages/nose-1.3.0-py2.7.egg
/Library/Python/2.7/site-packages/six-1.5.2-py2.7.egg
/Library/Python/2.7/site-packages/pyparsing-1.5.7-py2.7.egg
/Library/Python/2.7/site-packages/pika-0.9.13-py2.7.egg
/Library/Python/2.7/site-packages/patsy-0.2.1-py2.7.egg
/Library/Python/2.7/site-packages/Sphinx-1.2.1-py2.7.egg
/usr/local/lib/python2.7/site-packages
/Users/asselinpaul
/usr/local/lib/python2.7/site-packages/PIL
/usr/local/Cellar/matplotlib/2.0.1/libexec/lib/python2.7/site-packages
/usr/local/Cellar/numpy/1.12.1/libexec/nose/lib/python2.7/site-packages
/usr/local/Cellar/protobuf/3.3.0/libexec/lib/python2.7/site-packages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyObjC
/Library/Python/2.7/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
1
  • 1
    one option to try, open the Terminal, and type echo $PYTHONPATH will tell you if it has yet been defined on your system. If it has, check where it is defined (possibly in ~/.profile, ~/.bashrc, or ~/.bash_profile, et. al.) so a quick grep PYTHONPATH ~/.bash* or grep PYTHONPATH ~/.profile may reveal the variable definition. (This Q&A may also be helpful). If that Terminal command returns an empty line, create or edit one of those files and add the $PYTHONPATH definition you want Commented Jun 14, 2017 at 18:12

1 Answer 1

1

Try:

export PYTHONPATH=$PYTHONPATH:/Users/username/pymodules export PATH=$PATH:/Users/username/pymodules

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.