scipy osx 10.9 can't load gfortran library

I have tried installing scipy with pip and brew and both installs give this error ImportError: dlopen(/usr/local/lib/python2.7/site-packages/sklearn/linear_model/cd_fast.so, 2): Library not loaded: /usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.3/libgfortran.3.dylib Referenced from: /usr/local/lib/python2.7/site-packages/sklearn/linear_model/cd_fast.so Reason: image not found looking for

scipy osx 10.9无法加载gfortran库

我曾尝试用pip和brew安装scipy,并且都安装了这个错误 ImportError: dlopen(/usr/local/lib/python2.7/site-packages/sklearn/linear_model/cd_fast.so, 2): Library not loaded: /usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.3/libgfortran.3.dylib Referenced from: /usr/local/lib/python2.7/site-packages/sklearn/linear_model/cd_fast.so Reason: image not found 寻找有问题的图书馆显示可用的不同archetectu

Count the number occurrences of a character in a string

What's the simplest way to count the number of occurrences of a character in a string? eg count the number of times 'a' appears in 'Mary had a little lamb' str.count(sub[, start[, end]]) Return the number of non-overlapping occurrences of substring sub in the range [start, end] . Optional arguments start and end are interpreted as in slice notation. >>> senten

计算字符串中字符的出现次数

计算字符串中字符出现次数的最简单方法是什么? 例如,计算'Mary had a little lamb'出现'a'的次数 str.count(sub [,start [,end]]) 返回[start, end]范围内子串sub的非重叠次数。 可选参数start和end被解释为切片符号。 >>> sentence = 'Mary had a little lamb' >>> sentence.count('a') 4 你可以使用count(): >>> 'Mary had a little lamb'.count('a') 4 正如其他

Interpreting GPS info of exif data from photo in python

I am writing a small program to get the GPS info of a iphone jpg photo. The library I am using is the PIL in python. Now I am able to get the GPSInfo, which is something like: {1: 'N', 2: ((1, 1), (20, 1), (5365, 100)), 3: 'E', 4: ((103, 1), (41, 1), (1052, 100)), 5: 0, 6: (43, 1), 7: ((15, 1), (32, 1), (7, 1)), 16: 'T', 17: (77473, 452), 29: '2013:10:25'} How can I interpr

在python中解释来自照片的exif数据的GPS信息

我正在编写一个小程序来获取iphone jpg照片的GPS信息。 我正在使用的库是Python中的PIL。 现在我可以获得GPSInfo,这是类似于: {1: 'N', 2: ((1, 1), (20, 1), (5365, 100)), 3: 'E', 4: ((103, 1), (41, 1), (1052, 100)), 5: 0, 6: (43, 1), 7: ((15, 1), (32, 1), (7, 1)), 16: 'T', 17: (77473, 452), 29: '2013:10:25'} 我怎样才能解释这一点? 而且我注意到标签不是连续的,那么是否有任何作弊单

Projecting Coordinates in Numpy array

So I have come across a rather large bottle neck in my software. I have a set of co-ordinates in cords where each row corresponds to X,Y,Z co-ordinates. Each co-ordinate in cords has a defined area in atom_proj . The atoms variable corresponds to the cords variable and provides the key to the atom_proj . I project the co-ordinates onto the grid array then rotate and repeat until the number o

在Numpy数组中投影坐标

所以我在我的软件中遇到了一个相当大的瓶颈。 我有一组坐标的cords ,其中每一行对应于X,Y,Z坐标。 每个坐标的cords在限定区域atom_proj 。 atoms变量对应于cords变量,并将关键字提供给atom_proj 。 我将坐标投影到grid阵列上,然后旋转并重复,直到满足旋转次数。 我只投影X和Z坐标忽略Y. 我在下面简化了我的代码版本。 代码运行相对较快,适用于小坐标集和旋转次数。 但是如果坐标集和旋转列表都很大,可能需要很长

How to unset csrf in modelviewset of django

How to unset csrf in modelviewset of django-rest-framework? I'll use viewsets.ModelViewSet(http://django-rest-framework.org/api-guide/viewsets.html#modelviewset) of django-rest-framework. And my app is api server. So I don't need to use csrf. But I don't know how to unset csrf. Please give me a example! CSRF is only enforced if you're using SessionAuthentication. If yo

如何在django的modelviewset中取消设置csrf

如何在django-rest-framework的modelviewset中取消设置csrf? 我将使用django-rest-framework的viewsets.ModelViewSet(http://django-rest-framework.org/api-guide/viewsets.html#modelviewset)。 而我的应用程序是api服务器。 所以我不需要使用csrf。 但我不知道如何取消设置csrf。 请给我一个例子! 只有在使用SessionAuthentication时,CSRF才会执行。 如果您正在使用其他形式的身份验证(例如TokenAuthentica

Matplotlib: Color bar on contour without striping

In matplotlib, I'm looking to create an inset color bar to show the scale of my contour plot, but when I create the contour using contour, the color bar has white stripes running through it, whereas when I use contourf, the colorbar has the proper "smooth" appearance: How can I get that nice smooth colorbar from the filled contour on my normal contour plot? I'd also be OK wit

Matplotlib:轮廓上没有条纹的色条

在matplotlib中,我正在创建一个插入颜色条来显示我的轮廓图的比例,但是当我使用轮廓创建轮廓时,颜色条中有白色条纹,而当我使用contourf时,颜色条有适当的“光滑”外观: 如何从正常的等高线图上的实心轮廓中获得光滑的彩条? 我想也可以用零水平可以设置为白色的实心轮廓。 这里是生成这个例子的代码: from numpy import linspace, outer, exp from matplotlib.pyplot import figure, gca, clf, subplots_adjust, subpl

Conda and Python Modules

Sadly, I do not understand how to install random python modules for use within iPython Notebooks with my Anaconda distribution. The issue is compounded by the fact that I need to be able to do these things without always using a live internet connection. Most frequently I run into a problem with gcc compiling, where I can install a module with my basic Python2.7, but not with Conda or with the

Conda和Python模块

可悲的是,我不明白如何安装随我的Anaconda发行版在iPython笔记本中使用的随机Python模块。 这个问题更加复杂的是,我需要能够做到这些事情,而不必使用实时互联网连接。 我经常遇到一个gcc编译的问题,我可以用我的基本Python2.7安装一个模块,但不能与Conda或Anaconda / Python.exe一起安装。 Conda只能安装某些模块,而不是所有有效的Python模块? 什么是binstar? 为了使它成为“Conda-ready”,我该怎么做,如果有的

What is the correct way to prepare dataset for machine learning?

First of all, thank you for reading this post. I am a noob when it comes to machine learning and I am trying to use ML to classify some data. Now I have done some basic reading on supervised and unsupervised learning algorithms such as decision trees, clustering, neural networks ..etc. What I'm struggling to understand is the correct overall procedure for preparing datasets for a ML prob

准备机器学习数据集的正确方法是什么?

首先,感谢您阅读这篇文章。 当谈到机器学习时,我是一个noob,我试图用ML来分类一些数据。 现在我已经对有监督和无监督学习算法做了一些基本的阅读,例如决策树,聚类,神经网络......等等。 我正在努力理解的是为ML问题准备数据集的正确整体过程。 如何准备ML的数据集,以便我可以测量算法的准确性? 我目前的理解是,为了评估准确性,应该给算法提供预先标记的结果(来自数据集的重要子集?),以评估预期结果与算法

Slow bitwise operations

I am working on a Python library that performs a lot of bitwise operations on long bit strings, and I want to find a bit string type that will maximize its speed. I have tried the built-in Python int type, numpy, bitstring, and bitarray, and suprisingly, the Python ints seem to win hands down when it comes to bitwise operations. Everything I have googled says numpy should be much faster for vec

慢速按位操作

我正在研究一个对长位字符串执行大量按位操作的Python库,并且我想找到一个能够最大化速度的位串类型。 我尝试了内置的Python int类型,numpy,bitstring和bitarray,令人惊讶的是,当涉及到按位操作时,Python ints似乎赢得了双手。 我用Google搜索的所有内容都表示,对于像这样的矢量化操作,numpy应该快得多。 我以某种方式错误地使用numpy? 是否有另一个我可以使用的Python库,它实际上改进了Python的内置int类型? fro

Making letters uppercase using re.sub in python?

In many programming languages, the following find foo([az]+)bar and replace with GOOU1GAR will result in the entire match being made uppercase. I can't seem to find the equivalent in python; does it exist? You can pass a function to re.sub() that will allow you to do this, here is an example: def upper_repl(match): return 'GOO' + match.group(1).upper() + 'GAR' And an example o

在Python中使用re.sub使字母大写?

在许多编程语言中,以下 找到foo([az]+)bar并用GOOU1GAR 将导致整个比赛被大写。 我似乎无法在python中找到等价物; 它存在吗? 你可以传递一个函数给re.sub() ,它可以让你做到这一点,这里是一个例子: def upper_repl(match): return 'GOO' + match.group(1).upper() + 'GAR' 以及使用它的一个例子: >>> re.sub(r'foo([a-z]+)bar', upper_repl, 'foobazbar') 'GOOBAZGAR' 你的意思是这样吗? &g