How can I switch Python version for script


#1

Hi,

just started to deal with atom. After I had installed atom editor in conjunction with script python 2.7 is being used. However, I would like to use Python 3.5 which is already installed on my linux mint system.

Does anybody know how can I change it to python 3.5

thanks in advance


How to switch from Python 2.x to 3.x in atom
#2

I’m not sure what you mean. Atom doesn’t use or install python that I’m aware of. Does it have to do with some package you installed?


#3

Thanks for your reply

My intend is to run Python code in atom via script. The addon script has chosen Python 2.7(interpreter) by default. I am able to run python code with script ,however, I would like to run it with Python 3.5 instead of. There must be a way to switch it. I am not sure where it needs to be changed either in atom itself or in script.

Hopefully my wording is more precise.

Regards


#4

That requires a package, right? You should ask about this on the package repo.


#5

Right…will I find this section here on this board or are u refering to an other one


#6

I guess script just checks your PATH and uses what is finds there. What does the following output when run from a terminal?

echo $PATH
which python
python --version

#7

Every package has a github repo. If you go to setting and pull up the package there is a link to the github repo.


#8

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/python
Python 2.7.6

the output is showing what I have stated earlier. Atom has chosen /usr/bin. The desired version is located in /usr/local/bin/python3.5


#9

You’re launching Atom from the Dock on OS X, it appears. I assume that the PATH environment is different when you launch a Terminal window. The owner of the script package may want to utilize the environment package to normalize things.


#10

Hi guys,

I’ve solved my issue…

It was actually a no brainer…just added the path of my desired Python version to Configure Run Options. Now it is working properly.

Thanks a lot


#11

Meta comment:

I found this issue when I was facing the same problem, and I am pleased that Bema managed to solve the issue. The solution he found (without much help) worked for me, too

However I would like to point out that rather than being helpful, most of the “answers” were “You are asking the question wrong” without actually explaining how to ask it correctly.

For example:

That requires a package, right? You should ask about this on the package repo.

would have been much more helpful if it had explained what a package repo is and mentioned how to find one – or better yet posted a link to the package repo.

https://github.com/rgbkrk/atom-script

by the way

Remember if we knew all the cool stuff that you know we wouldn’t have to ask a question in the first place. Please be helpful, not cool.


#12

The Atom FAQ has information on how to contact the maintainers of any Atom community package or theme. I created the FAQ entry specifically for questions such as this one.


#13

There definitely should have been a link included (and I always do when I make that answer), but when I Google for “atom script repo”, the first result is exactly the right package. Maybe that’s Google spying on me because I’ve been to that page several times.


#14

#15

#16

For MacOS, the procedure is similar to what’s found in the above video beginning at 2:30, with the following differences. When you go to settings and click “Open Config Folder” you instead navigate as follows:
.Atom→ packages→ script→ lib→ grammars–>python.coffee

Then, you edit that file in the “exports.Python =” section by replacing both instances of “python” with “python3”


#17

Keep in mind that when you edit a file inside .atom/packages/, that edit will be erased the next time the package gets updated.


#19

Very good to point that out. In that case, I suppose I should not use this method? I only used it because it’s the only way I found so far that works. Can you suggest a better way?


#20

The best way is to use the command line. What I do is clone the package’s repo into my D:/github/atom/ folder and run apm link, which will create a symbolic link from .atom/packages/ to the current folder (for apm help, you quite naturally type apm help). If you want to avoid the command line, you could automate this using process-palette.


#22

I will l make a note of your method, but I must admit that there’s considerable inertia leaning me toward running all mac programs in the same way. And now that I know how to do what I’ve described above, it doesn’t seem that hard. But, if I get annoyed doing it that way, I’ll try out your method.