V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
snowfish
V2EX  ›  Python

请教个 pyd(cython 编译)的问题

  •  
  •   snowfish · 2019-12-05 14:41:23 +08:00 · 3182 次点击
    这是一个创建于 1575 天前的主题,其中的信息可能已经有所发展或是发生改变。
    可以这样用不?
    >>python *.pyd
    自己编了一个这么运行提示
    SyntaxError: Non-UTF-8 code starting with '\x90' in file tmp\main.cp37-win_amd64.pyd on line 1, but no encoding declared;
    ClericPy
        1
    ClericPy  
       2019-12-05 15:35:28 +08:00
    代码里不是全英文吧, 带上 # coding 那段 shebang
    snowfish
        2
    snowfish  
    OP
       2019-12-05 17:02:41 +08:00
    @ClericPy 有一些中文,代码头添加了 # -*- coding: UTF-8 -*-
    pyd 文件可以 import 用,但是 python pyd 就会报 encoding 的错
    weyou
        3
    weyou  
       2019-12-05 19:50:13 +08:00 via Android
    pyd 是 module 啊,不加-m 不行吧
    ClericPy
        4
    ClericPy  
       2019-12-05 21:07:45 +08:00
    随手搜了下, flask 有个 issue 也提到改成 python -m xxx.pyd 可以避免

    原来 2 3 楼你们说的是这个...
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1402 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:29 · PVG 01:29 · LAX 10:29 · JFK 13:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.