How can I set the path for python3 properly?
Asked Answered
J

1

6
$ echo $PATH
/usr/local/share/python:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

So /usr/local/bin is in my path.

when I do `which python3'

/usr/local/bin/python3

When I then try to create a virtualenv

mkvirtualenv py3000 --python=python3

The executable /Users/misdirectedpuffin/python3 (from --python=/Users/misdirectedpuffin/python3) does not exist

Virtualenv works when using the default python ie mkvirtualenv testenv' and when doing 'mkvirtualenv py3000 --python=/usr/local/bin/python3

It seems to be looking in $HOME for python3. How can I correct this?

** edit **

I can also set export python3=/usr/local/bin/python3 in bash_profile, then call $python3 with --python=$python3, but what I really want is --python=python3 without the dollar sign.

Jedjedd answered 13/11, 2013 at 9:48 Comment(5)
I wold guess you're virtualenv is misconfigured. But have you tried --python=/usr/local/bin/python3?Subtractive
Yes, and it works, but I don't want to have to type that everytime I want to use python 3.Jedjedd
virtualenv py3000 --python=/usr/local/bin/python3. Use the command virtualenv instead of mkvirtualenv.Nighthawk
You're virtualenvwrapper is propably not tied to the correct python. If you'd pip-3 install virtualenvwrapper` and then use /usr/local/bin/mkvirtualenv, there shouldn't be a need for the --python option.Subtractive
groups.google.com/forum/#!topic/virtualenvwrapper/ihdmGknVsK0 seems the recommended way for now is the explicit pathGroggery
J
0

After doing brew doctor, I was advised the following:

Warning: /usr/local/share/python is not needed in PATH.
Formerly homebrew put Python scripts you installed via `pip` or `pip3`
(or `easy_install`) into that directory above but now it can be removed
from your PATH variable.
Python scripts will now install into /usr/local/bin.
You can delete anything, except 'Extras', from the /usr/local/share/python
(and /usr/local/share/python3) dir and install affected Python packages
anew with `pip install --upgrade`.

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

After making these changes, I was able to mkvirtualenv py3000 -p python3

Jedjedd answered 13/11, 2013 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.