3

I have a project that using some third-party libraries. My questions is how to deploy my project to an environment that has not install these third-party libraries. In Java, I can just put all jars in the "lib" directory and write a bootstrap shell script that setting the CLASSPATH to contain the jars. I want a clean solution like this so that makes little influence on the environment.

zsxwing
  • 20,270
  • 4
  • 37
  • 59
  • Does the third party library contain pure python files? And are they stored in a directory hierarchy that is identical to directory hierarchy after they get installed? If that is the case, you can update [envvar PYTHONPATH](http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH) to add location of 3rd party library. python should be able to find modules then. – Vikas Jun 14 '12 at 08:19
  • When I develop the project, I use "easy_install" to install these third-party libraries. But I don't want to use easy_install on the online stable environment which maybe influence on other stable applications. I want the third-party libraries can be just a part of my project and easy to maintain. – zsxwing Jun 14 '12 at 08:30
  • Thanks. I find that PYTHONPATH can be set with the egg files. And now I can just put the egg files in a directory and add these egg files to PYTHONPATH. – zsxwing Jun 14 '12 at 08:35

2 Answers2

2

To create isolated python environments you can try virtualenv.

Enrico
  • 71
  • 3
0

I find that PYTHONPATH can be set with the egg files. And now I can just put the egg files in a directory and add these egg files to PYTHONPATH.

zsxwing
  • 20,270
  • 4
  • 37
  • 59
  • Came by this question, just wanted to say that in [another SO question](http://stackoverflow.com/questions/2026395/how-to-create-python-egg-file) I was told that [eggs are deprecated](http://guide.python-distribute.org/future.html). – 2rs2ts Jun 04 '13 at 18:25
  • So it seems that virtualenv is the only option, doesn't it? – zsxwing Jun 05 '13 at 02:28
  • [I'm not so sure.](http://stackoverflow.com/questions/16923899/what-is-the-best-practice-for-bundling-third-party-libraries-with-your-python-pr#comment24431304_16924002) – 2rs2ts Jun 05 '13 at 18:26