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
18870715400
V2EX  ›  Python

关于 pyd 在 Linux 中

  •  
  •   18870715400 · 2019-12-25 16:00:35 +08:00 · 3646 次点击
    这是一个创建于 1577 天前的主题,其中的信息可能已经有所发展或是发生改变。

    自己写的一个库文件在 windows 中放在 python 中的 site-packages 导入没有问题, 但是放在 linux 中的 anaconda 中的 site-packages 中导入却有问题, 有哪位大佬帮帮忙么

    目录大概结构

    --test
    ----A 
    ------init.py 
    ------a.pyd 
    ----B 
    ------init.py 
    ------b.pyd 
    ----init.py
    
    from test.A.a import xxx
    

    上述导入在 windows 中没有问题, 但是移到 linux 中就有问题, 能帮忙看看么

    4 条回复    2019-12-25 17:27:29 +08:00
    gwy15
        1
    gwy15  
       2019-12-25 16:10:56 +08:00
    pyd 是 cython 编译的二进制文件,没法跨平台的。你需要把 cython 文件重新在 linux 上编译,或者 Windows 上交叉编译。
    1462326016
        2
    1462326016  
       2019-12-25 16:41:38 +08:00
    1 楼正解。你需要把 py 文件重新编译成 Linux 下可用的 so 文件。pyd 是 windows 下的可执行文件,没办法跨平台执行。
    bantao
        3
    bantao  
       2019-12-25 17:26:07 +08:00
    pyd 是其他语言写的 python 库,是 python 的动态链接库。
    tabris17
        4
    tabris17  
       2019-12-25 17:27:29 +08:00
    pyd 是一个 dll 文件,是 windows 的 PE 可执行文件格式。linux 下必然不能运行的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2637 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 01:53 · PVG 09:53 · LAX 18:53 · JFK 21:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.