简体   繁体   English

强制将python模块安装在特定目录中

[英]Force python module to be installed in certain directory

Is there any way to force python module to be installed in the following directory? 有什么方法可以强制将python模块安装在以下目录中? /usr/lib/python2.7

This is kind of a non-answer, but are you able to use virtualenv? 这是一种无法解决的问题,但是您可以使用virtualenv吗?

http://www.virtualenv.org/en/latest/ http://www.virtualenv.org/en/latest/

It makes dealing with multiple versions of Python and library management amazingly easy. 它使处理多个版本的Python和库管理变得异常容易。 And it's simple to use once you get used to it. 习惯后,使用起来很简单。

You can create a Python 2.7 virtualenv and pip/easy_install will automatically install modules to it. 您可以创建一个Python 2.7 virtualenv,并且pip / easy_install将自动向其安装模块。

Install the module: 安装模块:

sudo pip-2.7 install guess_language sudo pip-2.7安装guess_language

Validate import and functionality: 验证导入和功能:

> Python2.7
>>> import guess_language
>>> print guess_language.guessLanguage(u"שלום לכם")

he

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM