3 Replies - 386 Views - Last Post: 30 January 2012 - 07:40 PM Rate Topic: -----

Topic Sponsor:

#1 Keta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-January 12

Equivalent to static linking?

Posted 29 January 2012 - 06:10 PM

Okay, I realize that python is an interpreted language, so there's no compiling and therefore no linking, so I don't even know for sure if what I'm asking is possible.

If I write a script which uses a third-party module such as scipy and I would like to distribute that script, is it possible to do so in a way that the user can still execute it even if they don't have the numpy package installed?
Is This A Good Question/Topic? 0
  • +

Replies To: Equivalent to static linking?

#2 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon


Reputation: 2570
  • View blog
  • Posts: 10,206
  • Joined: 15-July 08

Re: Equivalent to static linking?

Posted 30 January 2012 - 08:21 AM

I do believe that you can simply include the .py or .pyc file in a directory that you distribute. Then, you simply do the following:

import sys
sys.path.append("path/to/modules/directory")
import module


Was This Post Helpful? 1
  • +
  • -

#3 Keta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-January 12

Re: Equivalent to static linking?

Posted 30 January 2012 - 01:23 PM

This may sound like a stupid question, but would that work on any OS?
Was This Post Helpful? 0
  • +
  • -

#4 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon


Reputation: 2570
  • View blog
  • Posts: 10,206
  • Joined: 15-July 08

Re: Equivalent to static linking?

Posted 30 January 2012 - 07:40 PM

You may have to change the "/" to "\\" for windows or use the sys.path.sep characters.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1