简体   繁体   English

无需安装即可导入Python模块 - Sybase ASE

[英]Importing Python modules without installing - Sybase ASE

I need to use the Sybase Python module but our SA's won't install because it's not in the repo's. 我需要使用Sybase Python模块,但我们的SA不会安装,因为它不在repo中。 I've downloaded it and placed it on the box and would just like to 'import' or 'include' the module without installing it first. 我已下载它并将其放在盒子上,只想“导入”或“包含”模块而不先安装它。 - Is this possible? - 这可能吗? From the looks of it (Sybase ASE) it needs some type of compilation before use. 从它的外观(Sybase ASE)开始,它在使用之前需要某种类型的编译。 Is it possible for this type of work around? 这类工作有可能吗?

如果您可以让Sybase使用虚拟环境(我对Sybase一无所知,抱歉),也许您可​​以使用virtualenv安装模块,这通常不需要root访问权限或SA批准。

From the sybase documentation it looks like compilation is required, and Google tells me that it's not available in the easy_install repos either. sybase文档看起来需要编译,Google告诉我它在easy_install存储库中也不可用。

It may be easier to do a little social engineering (cookies anyone?) to get the modules installed for you. 为您安装模块可能更容易做一点社交工程(任何人?)? I don't know what your work environment is like, but if you really need the python Sybase module to do your job, either 1) the SA's should be installing it anyway, or 2) you need to be using something different. 我不知道你的工作环境是什么样的,但如果你真的需要python Sybase模块来完成你的工作,1)SA应该安装它,或2)你需要使用不同的东西。

You could always try writing a python script that does the d/l and install automagically and give it to the SAs so they don't have to worry about the "difficulty" of doing something besides apt-getting. 你总是可以尝试编写一个执行d / l的python脚本并自动安装并将其提供给SA,这样他们就不必担心除了apt-getting之外做某事的“困难”。

I don't know about the virtual environments, though - that might be an ideal avenue. 我不知道虚拟环境 - 这可能是一个理想的途径。

Assuming you meet the prerequisites for compiling, untarring it and then running: 假设您满足编译的先决条件,解压缩然后运行:

python setup.py build_ext

should produce a sybasect shared object. 应该生成一个sybasect共享对象。 Copying this file and the Sybase.py file somwhere onto PYTHONPATH might just do it for you. 将此文件和Sybase.py文件复制到PYTHONPATH可能只是为您执行此操作。

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

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