1

so heres an interesting problem.

I'm working on ubuntu 14.04 and trying to use pymongo. I've got both python and mongo installed and working AND pymongo installed. Here's the issue

if I were to run a program with import pymongo in it such as

python test.py

the result would be "no module named pymongo"

however, if I were to run

chmod +x test.py
./test.py

everything works. any ideas whats going on? thanks for the help

2
  • Do you use virtual environments? Commented Jul 23, 2014 at 13:40
  • i do not. just sublime 2 Commented Jul 23, 2014 at 13:47

1 Answer 1

0

Does your script have shebang ( "#!" ) as the first line? If so, it will indicate the program to run the script, which may be a different version of python than you are running by hand. It could be that pymongo is installed on that version but not the version you get when running it by hand in the terminal.

Sign up to request clarification or add additional context in comments.

2 Comments

ive got a !=/usr/bin/python and removal of this line still provokes the error
What does the command "which python" say when you run it. That will tell you what python you are using from the command line.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.