开发者

How to manually install Python modules in CentOS 5.5?

开发者 https://www.devze.com 2023-02-18 05:18 出处:网络
I have a specific Python 开发者_如何学JAVAmodule that I wrote that I want to add to my CentOS server. I\'m not sure where to add it though...

I have a specific Python 开发者_如何学JAVAmodule that I wrote that I want to add to my CentOS server. I'm not sure where to add it though...

In Windows, its pretty easy, just drop it in C:\Python2.X\Lib or site-packages and Python finds it. I'm not sure how to accomplish the same thing in Linux.

Do I need to use yum somehow? Or do I simply have to manually specify the script path before calling the module?


The clean option: write a setup.py, then run that.

The quick option: drop it in /usr/local/lib/python2.X/site-packages.


If you want to install the package globally, use this command:

$ python -c "import site; print site.getsitepackages()" # Python >= 2.7

If you're fine with per-user installation, use this command:

$ python -c "import site; print site.getusersitepackages()" # Python >= 2.7

This will print the directories that you should put your source in...or even better, check this duplicate's accepted response:

How do I find the location of my Python site-packages directory?

0

精彩评论

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