Windows下编译Python模块源代码需要什么C编译器?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows下编译Python模块源代码需要什么C编译器?

Hong Yuan-2
Windows下使用python setup.py install编译许多Python模块的源码时会出现类似
下面的错误信息:

running build_ext
building '_rl_accel' extension
error: Python was built with Visual Studio version 7.1, and extensions
need to be built with the same version of the compiler, but it isn't
installed.

需要附加安装什么C编译器以及基本类库才能编译这样的模块呢?应该不至于需要完
整地安装Visual Studio吧。

--

大管家网上建材超市
装修买建材 上网找大管家
http://www.homemaster.cn
Tel: 0086-21-34240987
Fax: 0086-21-64692422

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

文件写汉字问题。

weizi-2
                f = file('error.txt', 'a+')
                t = u'方动'
                print >> f, t
                f.close()

在print >> f, t出错,如何才能存汉字呢?
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 文件写汉字问题。

jondynet

>>> #coding=utf-8
>>> f = file('error.txt','a+')
>>> t = u'方动'
>>> print >> f, t

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    print >> f, t
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
>>> t = '方动'
>>> print >> f, t
>>> f.close()
>>>



2007/6/18, weizi <[hidden email]>:
               f = file('error.txt', 'a+')
               t = u'方动'
               print >> f, t
               f.close()

在print >> f, t出错,如何才能存汉字呢?
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

答复: 文件写汉字问题。

weizi-2
In reply to this post by weizi-2

自己回答自己吧。

f = file('error.txt', 'a+')
>                 t = unicode('方动','cp936').encode('utf-8')
>                 print >> f, t
>                 f.close()

> -----邮件原件-----
> 发件人: [hidden email]
> [mailto:[hidden email]] 代表 weizi
> 发送时间: 2007年6月18日 16:37
> 收件人: [hidden email]
> 主题: [python-chinese] 文件写汉字问题。
>
>                 f = file('error.txt', 'a+')
>                 t = u'方动'
>                 print >> f, t
>                 f.close()
>
> 在print >> f, t出错,如何才能存汉字呢?
> _______________________________________________
> python-chinese
> Post: send [hidden email]
> Subscribe: send subscribe to [hidden email]
> Unsubscribe: send unsubscribe to  [hidden email]
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

答复: 文件写汉字问题。

weizi-2
In reply to this post by jondynet

谢谢jondy.net 。刚看到。

> -----邮件原件-----
> 发件人: [hidden email]
> [mailto:[hidden email]] 代表 jondy.net
> 发送时间: 2007年6月18日 16:57
> 收件人: [hidden email]
> 主题: Re: [python-chinese] 文件写汉字问题。
>
> >>> #coding=utf-8
> >>> f = file('error.txt','a+')
> >>> t = u'方动'
> >>> print >> f, t
>
> Traceback (most recent call last):
>   File "<pyshell#4>", line 1, in <module>
>     print >> f, t
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3:
> ordinal not in range(128)
> >>> t = '方动'
> >>> print >> f, t
> >>> f.close()
> >>>
>
>
>
> 2007/6/18, weizi <[hidden email]>:
>
>               f = file('error.txt', 'a+')
>               t = u'方动'
>               print >> f, t
>               f.close()
>
> 在print >> f, t出错,如何才能存汉字呢?
> _______________________________________________
> python-chinese
> Post: send [hidden email]
> Subscribe: send subscribe to [hidden email]
> Unsubscribe: send unsubscribe to
> [hidden email]
> <mailto:[hidden email]>
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
qyb
Reply | Threaded
Open this post in threaded view
|

Re: Windows下编译Python模块源代码需要什么C编译器?

qyb
In reply to this post by Hong Yuan-2
通常 MSVC Toolkit 2003  + Platform SDK 就可以了

www.dup2.org/node/325
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: Windows下编译Python模块源代码需要什么C编译器?

Hong Yuan-2
In reply to this post by Hong Yuan-2
Hong Yuan 写道:

> Windows下使用python setup.py install编译许多Python模块的源码时会出现类似
> 下面的错误信息:
>
> running build_ext
> building '_rl_accel' extension
> error: Python was built with Visual Studio version 7.1, and extensions
> need to be built with the same version of the compiler, but it isn't
> installed.
>
> 需要附加安装什么C编译器以及基本类库才能编译这样的模块呢?应该不至于需要完
> 整地安装Visual Studio吧。
>  
Google了以下,好像用免费的Visual Studio没法完全支持Python extension的编译。

有一篇文章介绍了使用MinGW进行编译,试了以下,可以编译reportlab。有类似需求的同志可以看一下:

http://rdflib.net/issues/2007/01/03/can't_complete_install_because_%22the_.net_framework_sdk_needs_to_be_installed_before_building_extensions_for_python.%22/issue

--

大管家网上建材超市
装修买建材 上网找大管家
http://www.homemaster.cn
Tel: 0086-21-34240987
Fax: 0086-21-64692422

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese