简体   繁体   English

如何在mac上的python中导入非标准包? 此软件包不支持 pip 安装

[英]How can I import a non standard package in python on mac? This package does not support pip install

我以前用cmd安装非基本python包时用windows,但是我不知道在mac上怎么弄,这个打包后不能用pip安装到终端

It really depends a lot on the specific package.这在很大程度上取决于特定的包。 The options can be different, let me present you some:选项可能不同,让我向您介绍一些:

  • You can simply add the source files (if they are not properly packaged) to your project and import them您可以简单地将源文件(如果它们没有正确打包)添加到您的项目中并导入它们
  • In the same scenario, if the script is not packaged, you can check if there is a way to install it (read the docs).同样的场景,如果脚本没有打包,你可以检查是否有安装的方法(阅读文档)。 A common way to do it is by having a script in root called setup.py .一种常见的方法是在 root 中创建一个名为setup.py的脚本。 Try to see if there is a setup script or read the docs to see if there is a way to install it尝试查看是否有安装脚本或阅读文档以查看是否有安装它的方法
  • Check if the package can not be installed with another general package management (you mentioned you use a mac so check with homebrew )检查该软件包是否无法使用其他通用软件包管理进行安装(您提到您使用的是 mac,因此请使用homebrew 进行检查)
  • Another possible package management tool for Python is Anaconda , check that one too另一种可能的 Python 包管理工具是Anaconda ,也请检查一下

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM