0

Relatively new developer here, and this is my first time posting. For two days I have been searching for the answer to the issue I have been having, following guides and such but I seem to keep digging myself into a deeper hole with this one. So I decided to post here for help

What is happening is it appears that I have python installed properly, but when I run echo $PATH in terminal I get this:

/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/python3

I have tried editing the ~/.bash_profile to make sure that the correct path is listed, and currently it appears as:

/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}

I'm assuming that having the ${PATH} there may be what's causing it to continuously echo as it is, but I'm not sure about removing anything since I don't want to screw things up.

Also when using sublime text 3 I can't get similar errors, I'm assuming because it's not correctly finding the path. I'm not able to build until I can find a way to resolve this, but for the moment at least I am at a loss.

Any help would be greatly appreciated!!!

Ivan Vinogradov
  • 4,269
  • 6
  • 29
  • 39
  • What do `which python` and `python --version` output? – Dascienz Apr 25 '18 at 14:12
  • `usr/bin/python` and `Python 3.6.5` – IconoclastTS Apr 25 '18 at 14:19
  • OK, and what do the `export PATH` lines in your `.bash_profile` say exactly? (If your name is in there, just edit it to username in case you want to remain anonymous) – Dascienz Apr 25 '18 at 14:23
  • export path shows `usr/local/bin` - I'm thinking maybe that's the part I need to change? – IconoclastTS Apr 25 '18 at 14:26
  • Try changing `export PATH=/usr/local/bin` to `export PATH=/usr/local/bin:$PATH`? I don't think this will work since it looks like your `$PATH` has some duplicate pieces as Ali Cirik mentioned so it may need to be fixed. – Dascienz Apr 25 '18 at 14:36
  • What do you mean by "When using Sublime Text 3 I can't get similar errors`? Do you mean that it's having issues running `python` when you build? If so, what does the error look like? – OdatNurd Apr 25 '18 at 20:15
  • Yes that is what I meant, the error looks like: `IOError: [Errno 2] No such file or directory: '' [Finished in 0.1s with exit code 1] [shell_cmd: python -m py_compile ""] [dir: /Applications/Sublime Text.app/Contents/MacOS] [path: /usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/python3]` – IconoclastTS Apr 25 '18 at 21:19

2 Answers2

0

Install Homebrew and then install python with brew install python

  1. See if you have python installed with brew by ll /usr/local/bin/python*
  2. /Library/Frameworks/Python.framework/Versions/3.6/bin part in your path is duplicated. Remove them and keep your path as /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/python3
Ali Cirik
  • 1,475
  • 13
  • 21
  • Tried that as well, same results thus far – IconoclastTS Apr 25 '18 at 13:46
  • It's definitely installed with brew currently, right now the bash profile shows the path as just `/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}` export path shows `usr/local/bin` Anything I should change with the export path, or should I remove something else? – IconoclastTS Apr 25 '18 at 14:25
  • After the suggested changes I am getting `/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/python3` – IconoclastTS Apr 25 '18 at 21:17
  • I haven't overwritten anything at all since the last save, and confirmed that everything was intact, but now the batch profile is entirely blank, so I'm pretty much lost at this point. – IconoclastTS Apr 25 '18 at 21:21
0

Seems like you downloaded Python 3 from python.org. You should uninstall and use homebrew.

  1. Uninstall whatever you downloaded from python.org by replacing 2.7 with 3.6 in these instructions. This should fix your path. From now on, don't mess with it (leave ~/.bash_profile empty). Homebrew handles that.

  2. Reinstall Python with homebrew brew reinstall python, I would personally install with tcl-tk: brew reinstall python --with-tcl-tk which will make idle3 run without warnings.

JBallin
  • 8,481
  • 4
  • 46
  • 51