Skip to content

添加python库的路径:/Library/Frameworks/#35

Closed
UbunGit wants to merge 2 commits into
pvieito:masterfrom
ubunfork:master
Closed

添加python库的路径:/Library/Frameworks/#35
UbunGit wants to merge 2 commits into
pvieito:masterfrom
ubunfork:master

Conversation

@UbunGit

@UbunGit UbunGit commented Apr 30, 2021

Copy link
Copy Markdown

M1 mac pro 安装python在/Library/Frameworks/下导致找不到python库,新增了/Library/Frameworks/

另外有两个问题,希望能够得到解答

无法找到python库

在使用的过程中,一直不明白
PythonLibrary.useVersion
PythonLibrary.useLibrary
这两个方法怎么设置,试了一下几个:

       PythonLibrary.useVersion(3, 8)
       PythonLibrary.useVersion(3)
       PythonLibrary.useLibrary(at: "/usr/local/bin/python3.8")

都不能工作,提示:

Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library

PYTHON_LIBRARY 不知道怎么设置,太难了!!!

无法使用mac自带python3

这次Mac 更新的时候添加了python3的库,直接调用

 PythonLibrary.useLibrary(at: "/usr/bin/python3")
 let py_sys = Python.import("sys")

提示:sys 错误

@xiaoxiaonainai

Copy link
Copy Markdown

PythonLibrary.useLibrary(at: "/usr/bin/python")
let sys = try! Python.import("sys")
let xlrd = try! Python.import("xlrd")
xlrd找不到,报:PythonKit/Python.swift:674: Fatal error: 'try!' expression unexpectedly raised an error: Python exception: No module named xlrd
2021-09-08 18:05:22.590529+0800 myApp[2938:156669] PythonKit/Python.swift:674: Fatal error: 'try!' expression unexpectedly raised an error: Python exception: No module named xlrd

确认过Mac自带的python2.7是已经添加了xlrd的了
求大佬救救

@pvieito pvieito closed this Sep 10, 2021
@pvieito

pvieito commented Sep 10, 2021

Copy link
Copy Markdown
Owner

See #38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants