在macOS上编辑PYTHONPATH

时间:2017-06-14 17:48:02

标签: python python-3.x pythonpath

我的Python3安装失败了。我相信这可能是由于我的$ PYTHONPATH需要清理。如何编辑PYTHONPATH(我不知道它在哪里)。

我运行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 个答案:

答案 0 :(得分:1)

尝试:

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