小编mik*_*.ro的帖子

安装python时在$ PATH中找不到可接受的C编译器

我正在尝试在我的共享主机上安装新的python环境.我按照这篇文章中的步骤进行操作:

mkdir ~/src
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar -zxvf Python-2.7.1.tar.gz
cd Python-2.7.1
mkdir ~/.localpython
./configure --prefix=/home/<user>/.localpython
make
make install
Run Code Online (Sandbox Code Playgroud)

在进入"./configure --prefix =/home // .localpython"命令后,我得到以下输出:

checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux3
checking EXTRAPLATDIR... 
checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home3/mikos89/Python-2.7.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details. …
Run Code Online (Sandbox Code Playgroud)

python compiler-errors virtualenv

201
推荐指数
11
解决办法
37万
查看次数

新的Regexp不起作用

我正在尝试将以下表达式转换为"new Regexp()"样式:

http://jsfiddle.net/HDWBZ/

var Wyrazenie = /\btest[a-z]*/g;
Run Code Online (Sandbox Code Playgroud)

我真的很困惑,不知道如何解决它.以下是我所做的,但显然它不起作用.

var Wyraznie = new RegExp("\btest[a-z]*","g");
Run Code Online (Sandbox Code Playgroud)

还有一个问题,如果不是"测试"我会使用变量怎么样?

javascript regex

7
推荐指数
1
解决办法
915
查看次数

Webview不显示带有颜色的文本

在我的应用程序中,我在webview中显示一些Html内容:

String webViewConent = 'this is some <span style="color:#2ecc71">sample</span> string'
webView.loadData(omowienie, "text/html; charset=utf-8", "UTF-8");
Run Code Online (Sandbox Code Playgroud)

但是,在上次应用更新后,与其他一些事情有关,对于某些用户来说,webview无法正常工作.他们只看到span标签之前的字符串.该问题与任何特定的Android版本无关.

android webview android-webview

7
推荐指数
4
解决办法
444
查看次数

设置restrict_xpaths设置后的UnicodeEncodeError

我是蟒蛇和scrapy的新手.将restrict_xpaths设置设置为"// table [@ class ="lista"]后,我收到了以下回溯.奇怪的是,通过使用其他xpath规则,爬虫可以正常工作.

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/base.py", line 800, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/task.py", line 602, in _tick
    taskObj._oneWorkUnit()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/task.py", line 479, in _oneWorkUnit
    result = self._iterator.next()
  File "/Library/Python/2.7/site-packages/scrapy/utils/defer.py", line 57, in <genexpr>
    work = (callable(elem, *args, **named) for elem in iterable)
--- <exception caught here> ---
  File "/Library/Python/2.7/site-packages/scrapy/utils/defer.py", line 96, in iter_errback
    yield it.next()
  File "/Library/Python/2.7/site-packages/scrapy/contrib/spidermiddleware/offsite.py", line 23, in process_spider_output
    for x in result:
  File "/Library/Python/2.7/site-packages/scrapy/contrib/spidermiddleware/referer.py", line 22, in <genexpr>
    return (_set_referer(r) …
Run Code Online (Sandbox Code Playgroud)

python encoding scrapy

4
推荐指数
1
解决办法
978
查看次数

调用该函数,检查范围内的回文

我正在尝试创建一个函数,它递归地检查给定范围内的回文.该范围被发送到"is_palindrome_multi",然后调用"is_palindrome".但是,它不适用于高于10的数字,因此限制步骤似乎是:

elif data [0] == data [-1]:

声明.为什么它不会像11,22这样的数字返回?我将很感激解释.

def is_palindorme_multi(beg, end):
    for i in range(beg, end):
        i = str(i)
        if is_palindrome(i) == True:
            print "Palindrome"
        else:
            print "Not palindrome"


def is_palindrome(data):    
    print data,
    if len(data)==1 or len(data)==0:
        return True
    elif data[0]==data[-1]:
        is_palindrome(data[1:-1])
    else:
        return False
Run Code Online (Sandbox Code Playgroud)

python python-2.7

0
推荐指数
1
解决办法
95
查看次数