Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python formula does not link to /usr/local/bin/python #16212

Closed
4 tasks done
ahmetb opened this issue Jul 30, 2017 · 5 comments
Closed
4 tasks done

python formula does not link to /usr/local/bin/python #16212

ahmetb opened this issue Jul 30, 2017 · 5 comments

Comments

@ahmetb
Copy link
Contributor

ahmetb commented Jul 30, 2017

Please always follow these steps:

Please note we will close your issue without comment if you delete or do not fill out the issue checklist and provide ALL the requested information.

To help us debug your issue please explain:

What you were trying to do (and why)

After a recent brew upgrade, the Python virtualenvwrapper.sh started giving errors. It said python cannot find virtualenvwrapper module. I was trying to fix this error message.

What happened (include command output)

Then I did a bit debugging and realized it started using the macOS system python (/usr/bin/python) after a while. No matter how many times I reinstalled python formula, I still did not get a /usr/local/bin/python symlink:

$ brew unlink python && brew link python -v
Unlinking /usr/local/Cellar/python/2.7.13_1... 32 symlinks removed
Linking /usr/local/Cellar/python/2.7.13_1...
ln -s ../Cellar/python/2.7.13_1/bin/2to3-2 2to3-2
ln -s ../Cellar/python/2.7.13_1/bin/2to3-2.7 2to3-2.7
ln -s ../Cellar/python/2.7.13_1/bin/easy_install easy_install
ln -s ../Cellar/python/2.7.13_1/bin/easy_install-2.7 easy_install-2.7
ln -s ../Cellar/python/2.7.13_1/bin/idle2 idle2
ln -s ../Cellar/python/2.7.13_1/bin/idle2.7 idle2.7
ln -s ../Cellar/python/2.7.13_1/bin/pip pip
ln -s ../Cellar/python/2.7.13_1/bin/pip2 pip2
ln -s ../Cellar/python/2.7.13_1/bin/pip2.7 pip2.7
ln -s ../Cellar/python/2.7.13_1/bin/pydoc2 pydoc2
ln -s ../Cellar/python/2.7.13_1/bin/pydoc2.7 pydoc2.7
ln -s ../Cellar/python/2.7.13_1/bin/python2 python2
ln -s ../Cellar/python/2.7.13_1/bin/python2-config python2-config
ln -s ../Cellar/python/2.7.13_1/bin/python2.7 python2.7
ln -s ../Cellar/python/2.7.13_1/bin/python2.7-config python2.7-config
ln -s ../Cellar/python/2.7.13_1/bin/pythonw2 pythonw2
ln -s ../Cellar/python/2.7.13_1/bin/pythonw2.7 pythonw2.7
ln -s ../Cellar/python/2.7.13_1/bin/smtpd2.7.py smtpd2.7.py
ln -s ../Cellar/python/2.7.13_1/bin/smtpd2.py smtpd2.py
ln -s ../Cellar/python/2.7.13_1/bin/wheel wheel
ln -s ../../../Cellar/python/2.7.13_1/share/man/man1/python.1 python.1
ln -s ../../../Cellar/python/2.7.13_1/share/man/man1/python2.1 python2.1
ln -s ../../../Cellar/python/2.7.13_1/share/man/man1/python2.7.1 python2.7.1
ln -s ../Cellar/python/2.7.13_1/share/python python
ln -s ../../Cellar/python/2.7.13_1/lib/pkgconfig/python-2.7.pc python-2.7.pc
ln -s ../../Cellar/python/2.7.13_1/lib/pkgconfig/python.pc python.pc
ln -s ../../Cellar/python/2.7.13_1/lib/pkgconfig/python2.pc python2.pc
ln -s ../../Cellar/python/2.7.13_1/Frameworks/Python.framework/Headers Headers
ln -s ../../Cellar/python/2.7.13_1/Frameworks/Python.framework/Python Python
ln -s ../../Cellar/python/2.7.13_1/Frameworks/Python.framework/Resources Resources
ln -s ../../../Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7 2.7
ln -s ../../../Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/Current Current
32 symlinks created

What you expected to happen

To have a symlink at /usr/local/bin/python after installing python formula so that it replaces my system Python.

Step-by-step reproduction instructions (by running brew install commands)

  • brew install python
  • stat /usr/local/bin/python → does not exist.
@DomT4
Copy link
Member

DomT4 commented Jul 30, 2017

See #14408 & the significant discussion there.

@DomT4
Copy link
Member

DomT4 commented Jul 30, 2017

Also the caveats at the end of the python installation:

==> Caveats
This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add
the following to ~/.zshrc:
  export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Pip and setuptools have been installed. To update them
  pip2 install --upgrade pip setuptools

You can install Python packages with
  pip2 install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: http://docs.brew.sh/Homebrew-and-Python.html

@marisveide
Copy link

I am still having this issue.
After installing python with brew, there is no symlink /usr/local/bin/python

@ilovezfs
Copy link
Contributor

@marisveide python@2 creates /usr/local/bin/python. python creates /usr/local/bin/python3.

@marisveide
Copy link

Thanks, @ilovezfs!
I ended up creating symbolic links for python and pip manyally.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants