Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8047463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:06:21+00:00 2026-06-05T06:06:21+00:00

I am trying to call the following Python script from the Ubuntu terminal using

  • 0

I am trying to call the following Python script from the Ubuntu terminal using the standard

python rosen.py

but it fails. I can hit F5 in idle and it works fine but it fails when called from the terminal. The code for rosen.py is as follows:

from scipy.optimize import fmin

def rosen(x):
    b=sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)
    print b
    return b

x0 = [1.3, 0.7, 0.8, 1.9, 1.2]
xopt = fmin(rosen, x0, xtol=1e-8)
print xopt

again, when run in idle it works fine, but when called from the terminal it says that scipy doesn’t exist…

I can run the following numpy code from the terminal or idle and it works fine:

import numpy as np
a=np.sin(1)
print a

It will print in either the terminal window or idle window depending where it was called.

Basically, how can I get the rosen.py to import SciPy and run when called from the Ubuntu terminal??

Thank you very much for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:06:23+00:00Added an answer on June 5, 2026 at 6:06 am

    It looks to me like your version of idle is pointing at a different python implementation than the one that is first in your PATH. Try this (from the commandline — not python):

    head -1 `which idle`
    

    and:

    which python
    

    Are the paths the same? If not, that’s probably your problem. To fix this, depending on your system settings, you can reorder your PATH to get the correct version of python to be called, or you could create a symbolic link to the correct python implementation somewhere very early in your path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to copy files inside a Python script using the following code: inf,outf
I am trying to send email (Gmail) using python, but I am getting following
I am trying to call the following functions sequentially, but they don't necessarily return
I am trying to perform a nested AJAX call using the following code. The
Im trying to call image_tag image.jpg from devise Mailer template but since its an
im trying to call a bean from a javascript, using a h:commandLink. i have
I'm trying to solve the following problem: Say I have a Python script (let's
I'm trying to get a simple python script from the learnpythonthehardway tutorial to show
I am trying to write a Python script that will copy files from one
I'm trying to run a shell command from within a python script which needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.