Is it possible to add non-native libraries to python?

Asked

Viewed 290 times

0

I’m wondering if there is a possibility to add a non-native library from python.

Example, I’m using the NetworkX to create graph, I need to install the library and everything else.

I am wanting to add this library directly to the program, in case I use it on another pc so I no longer need to install it, kind of already encapsulate this library to the code.

Is there any way to do that?

Thank you.

1 answer

1

Is there a way for you to add it directly to your project code and get it, in a way, already embedded.

Or you can use a folder in your project with a name you want and in python you put:

from modulo import modulo

This should work in your case!

  • thanks for the answer. But how would this first way Voce answered? Thanks

  • You can let me know if it is in the same folder as your code, which folder name and code?

  • I have the downloaded framework which is Networkx, I can put it in the same folder where my code is, the folder name is paa, the folder name of the framework is networkx and the code is redestream.py.

  • you probably have to run: from networkx import * or from networkx import networkx

  • There were some errors, according to your recommendation, I will put the error: 'Traceback (most recent call last):&#xA; File "rede_fluxo_max.py", line 2, in <module>&#xA; from networkx import *&#xA; File "/home/ubuntu/Documentos/paa/networkx/__init__.py", line 56, in <module>&#xA; import networkx.utils&#xA; File "/home/ubuntu/Documentos/paa/networkx/utils/__init__.py", line 2, in <module>&#xA; from networkx.utils.decorators import *&#xA; File "/home/ubuntu/Documentos/paa/networkx/utils/decorators.py", line 7, in <module>&#xA; from decorator import decorator&#xA;ImportError: No module named 'decorator'

  • tries to put:from networkx import *

  • Or check out this link: [http://stackoverflow.com/questions/4383571/importing-files-from-different-folder-in-python]

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.