开发者

I created a Python egg; now what?

I've finally figured out how to create a Python egg and gotten it to work. Now... what do I do with it? How do I use it? How do I ensure that everything was correctly included? 开发者_运维知识库(Simple steps please... not just redirection to another site. I've googled, but it's confusing me, and I was hoping someone could explain it in a couple of simple bullet points or sentences.)

Edit:

I asked this question a couple of weeks ago, and I'm clarifying now in the hope of getting clearer answers... basically, I have an egg, I want to take it to another machine and be able to use it and import modules from it from my (other, unrelated) code. How do I do this?


I'd advise only using python setup.py sdist to create zips and/or tarballs, and skip eggs.

If you want to look at the egg it is a zip file; you can use unzip -v MyEgg-0.1.egg and see its contents to see if includes all the files you expect. You can also try installing it. Use virtualenv to create a new environment (use --no-site-packages to make it isolated) and try installing it into that environment, like:

$ virtualenv --no-site-packages test-env
$ ./test-env/bin/easy_install path/to/MyEgg-0.1.egg
$ ./test-env/bin/python

And then see if you can import it and use your package like you expect. You can do all the same things to test an sdist too.


What I ended up doing was:

  1. Ran PYTHONPATH=fullPathOfMyEgg in command line
  2. Was then able to do import someModuleInMyEgg from my Python code

I'm not sure if this is the most standard or accepted way to do it, but it worked. If anyone has any comments or other methods, please feel free to add...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜