我需要安装psycopg2的openerp安装过程,但我总是发现错误.我已经使用pip和easy_install,我的gcc是最新的版本.真的需要你的帮助来解决我的问题......
这是我对easy_install的完整错误..
[root@server01 ~]# easy_install psycopg2
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.5
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
Processing psycopg2-2.4.5.tar.gz
Running psycopg2-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-anWVvJ/psycopg2-2.4.5/egg-dist-tmp-cZbdtn
no previously-included directories found matching 'doc/src/_build' In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:31:22: error: libpq-fe.h: No such file or directory In file included from psycopg/psycopgmodule.c:29:
...
error: Setup script exited with error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud) 我已经尝试过此代码,但我没有在帐户中看到共享照片.
File file = new File("sdcard/1346249742258.jpg");
String photoUri = null;
photoUri = file.getAbsolutePath();
Intent shareIntent = ShareCompat.IntentBuilder.from(this)
.setText("Sharing an image on Google!").setType("image/jpeg")
.setStream(Uri.parse(photoUri)).getIntent()
.setPackage("com.google.android.apps.plus");
startActivity(shareIntent);
Run Code Online (Sandbox Code Playgroud) 我开始使用matplotlib库来获取图形.但是当我使用"plot(x,y)"时,它会返回"未定义绘图".
要导入,我使用以下命令:
from matplotlib import *
有什么建议?
使用以下语法读回有关堆栈溢出的问题
In [1]: [lambda: x for x in range(5)][0]()
Out[1]: 4
In [2]: [lambda: x for x in range(5)][2]()
Out[2]: 4
Run Code Online (Sandbox Code Playgroud)
但是我很难理解为什么这个输出恰好是4,我的理解是它总是将列表的最后一个值作为输出,
In [4]: [lambda: x for x in [1,5,7,3]][0]()
Out[4]: 3
Run Code Online (Sandbox Code Playgroud)
但仍然不相信这个语法如何以最后一个值结束.
如果我能对这种语法得到正确的解释,我将非常高兴
我有一个12伏的小型相机,放在一个蜂箱内.它用红外LED点亮(蜜蜂看不到红外线).它沿着电线向我的小电视监视器发送一个简单的NTSC信号.这让我可以看到蜂巢的内部,而不会打扰蜜蜂.
女王背后有一个圆点,当她在框架中时非常明显.
我希望有一些处理信号的东西,以便在皇后在帧中时进行注册.这不一定非常准确.不是处理视频,而是每隔10秒拍摄一次图像并查看是否存在一定量的亮度(表示女王在帧中)也是如此.
这很有用,因为它可以帮助养蜂人知道女王是否还活着(如果她没有出现好几天就可能意味着什么是错的).
我很想听听有关处理此视频的廉价方法的建议,特别是在低功耗的情况下.覆盆子?Arduino的?
相机示例: 这里
示例视频(帧中没有女王): 这里
我有配置文件,
[local]
variable1 : val1 ;#comment1
variable2 : val2 ;#comment2
Run Code Online (Sandbox Code Playgroud)
像这样的代码只读取键的值:
class Config(object):
def __init__(self):
self.config = ConfigParser.ConfigParser()
self.config.read('config.py')
def get_path(self):
return self.config.get('local', 'variable1')
if __name__ == '__main__':
c = Config()
print c.get_path()
Run Code Online (Sandbox Code Playgroud)
但我也想阅读评论以及价值,这方面的任何建议都会非常有帮助.
我有连接到Microsoft SQL Server实例从一个问题pyODBC的内Ubuntu (12.10)机.
我得到的错误是:
pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data Source name not found, and no default driver specified (0) (SQLDriverConnect)')
Run Code Online (Sandbox Code Playgroud)
用于pyodbc的连接字符串是:
self.corpus_cnxn = pyodbc.connect('DRIVER={FreeTDS};SERVER=UKEDN-06880;DATABASE=db1;UID=user;PWD=pass')
Run Code Online (Sandbox Code Playgroud)
这似乎可以在Windows中的pyODBC中正常工作(只需要将DRIVER更改为'SQL Server'而不是'FreeTDS'),当我尝试使用终端上的tsql 工具从Ubuntu机器连接时,它工作正常,以下命令:
tsql -S UKEDN-06880 -p 1433 -U user -P pass
Run Code Online (Sandbox Code Playgroud)
我可以选择任何没有问题的表,它似乎没有在pyODBC内工作.
任何帮助或建议将不胜感激,我的Linux技能非常弱,我完全陷入困境,虽然它从tsql工作,我感觉非常接近!
所以我是python的新手,我迫切需要帮助.
我有一个文件,其中有一堆id(整数值)写在'em.它是一个文本文件.
现在我需要将文件中的每个id传递给一个url.
例如"https://example.com/[id]"
它将以这种方式完成
A = json.load(urllib.urlopen("https://example.com/(the first id present in the text file)"))
print A
Run Code Online (Sandbox Code Playgroud)
这将基本上做的是它将读取有关上述URL中存在的id的某些信息并显示它.我希望它以循环格式工作,在其中它将读取文本文件中的所有ID并将其传递给'A'中提到的URL并持续显示值.有没有办法做到这一点?
如果有人能帮助我,我将非常感激!
我使用的是Python 3.2.3版.我试图连续打印一个数字列表,打印命令似乎总是在行打印数字.
例
numbers = [1, 2, 3, 4, 5];
for num in numbers:
print("\t ", num)
Run Code Online (Sandbox Code Playgroud)
输出是:
1
2
...
Run Code Online (Sandbox Code Playgroud)
所需的输出为1 2 3 4 5
我很感激你的帮助.Ps我在这里搜索了网页,大多数问题都与Python 2.7有关.
我有一个字典对象:
menu = {'dinner':{'chicken':'good','beef':'average','vegetarian':{'tofu':'good','salad':{'caeser':'bad','italian':'average'}},'pork':'bad'}}
Run Code Online (Sandbox Code Playgroud)
我试图使用pydot与"菜单"数据创建一个图表(决策树)此.
'晚餐'将是顶级节点,其价值(鸡肉,牛肉等)低于它.参考链接,图形函数有两个参数; 源和节点.
它看起来像这样:
"王"将是"晚餐","主"将是"鸡肉","牛肉"等.
我的问题是:如何访问值中的键?要从这些数据创建一个树,我觉得我需要创建一个循环,检查是否有特定键的值并绘制它.我不确定如何调用任何字典对象的值(如果它不一定被称为'晚餐'或具有尽可能多的元素.).
有关如何绘制图表的任何建议吗?
python ×9
android ×1
arduino ×1
centos ×1
centos5 ×1
closures ×1
configparser ×1
dictionary ×1
gcc ×1
google-plus ×1
json ×1
lambda ×1
linux ×1
openerp ×1
pydot ×1
pyodbc ×1
python-3.x ×1
sql-server ×1
ubuntu ×1
url ×1
urllib ×1
urlopen ×1