GVKun编程网logo

Python-什么是setup.py?(python中的setup)

7

想了解Python-什么是setup.py?的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于python中的setup的相关问题,此外,我们还将为您介绍关于ERROR:Command"pyt

想了解Python-什么是setup.py?的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于python中的setup的相关问题,此外,我们还将为您介绍关于ERROR: Command "python setup.py egg_info" python-nss、pip 无法导入 Cython 但 python setup.py install 可以、Python Setup.py、python setup.py install是什么意思的新知识。

本文目录一览:

Python-什么是setup.py?(python中的setup)

Python-什么是setup.py?(python中的setup)

谁能解释一下,setup.py它是什么以及如何配置或使用?

答案1

小编典典

setup.pypython文件,通常会告诉你要安装的模块/软件包已与Distutils打包并分发,Distutils是分发Python模块的标准。

这使你可以轻松安装Python软件包。通常写就足够了:

$ pip install . 

pip将使用setup.py安装模块。避免setup.py直接致电。

ERROR: Command

ERROR: Command "python setup.py egg_info" python-nss

[root@localhost ~]# pip install python-nss

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won''t be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: http://pypi.douban.com/simple
Collecting python-nss
  Downloading http://pypi.doubanio.com/packages/6b/29/629098e34951c358b1f04f13a70b3590eb0cf2df817d945bd05c4169d71b/python-nss-1.0.1.tar.bz2 (222kB)
     |████████████████████████████████| 225kB 31kB/s 
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-JGnrT5/python-nss/setup.py", line 409, in <module>
        sys.exit(main(sys.argv))
      File "/tmp/pip-install-JGnrT5/python-nss/setup.py", line 333, in main
        nss_include_dir  = find_include_dir([''nss3'', ''nss''],   [''nss.h'',  ''pk11pub.h''], include_roots=include_roots)
      File "/tmp/pip-install-JGnrT5/python-nss/setup.py", line 94, in find_include_dir
        raise ValueError("unable to locate include directory containing header files %s" % include_files)

    ValueError: unable to locate include directory containing header files [''nss.h'', ''pk11pub.h'']

ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-JGnrT5/python-nss/


查看错误日志缺少头文件

进入python-nss官网,写着To build python-nss you the C language header files and libraries for both NSPR and NSS will need to be installed. This is system and distribution specific, as such we cannot give you explicit instructions. On Linux typically these packages are called:

  • nss-devel
  • nspr-devel

yum install nss-devel -y

yum install nspr-devel -y

pip 无法导入 Cython 但 python setup.py install 可以

pip 无法导入 Cython 但 python setup.py install 可以

如何解决pip 无法导入 Cython 但 python setup.py install 可以?

我正在编写一个 Cython 模块。我安装了 Cython。我的 setup.py 文件的开头如下:

import os
from distutils.command.build_ext import build_ext
from typing import Callable

from setuptools import setup,Extension

from Cython.Build import cythonize

运行 pip install . 时,出现以下错误:

  ModuleNotFoundError: No module named ''Cython''

但是,如果我运行 python setup.py install,一切都会按预期进行。

我跑了 pip install Cython --upgrade

Python 版本:3.7.10

Cython 版本:0.29.23

pip 版本:21.0.1

我确信需要更多信息,但不确定我应该提供什么。

编辑:

Python 路径:/Users/petioptrv/miniconda3/envs/ib-insync-sim-test/bin/python

点路径:/Users/petioptrv/miniconda3/envs/ib-insync-sim-test/bin/pip

如路径所示,我使用 conda 来管理我的环境。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

Python Setup.py

Python Setup.py

所以我是 python建筑和包装的新手.

我很困惑我的设置是否可行,以及是否有更好的方法来构建代码文件以实现更好的打包.

从本质上讲,我有:

/top_folder/
|___setup.py
|___file1.py
|___file2.py
|___lib/                        <--- (FOLDER)
    |_____ binary1
    |_____ libfile1.py
    |_____ libfile2.awk
    |_____ __init__.py

这样的setup.py文件是正确的方法吗?

setup(
    name=''myName'',version=''1.0a'',#packages=[''lib''],url=''http://myUrl.co.uk'',license=''GPL2'',author=''myAuthorName'',author_email=''myAuthorEmail'',description=''myDescription'',py_modules=[''file1'',''file2'']
)

解决方法

也许这篇 Open Sourcing a Python Project the Right Way的帖子可能有所帮助.它不仅包括setup.py文件,还包括几乎所有工具和概念.

python setup.py install是什么意思

python setup.py install是什么意思

python setup.py install是什么意思

python setup.py install是什么意思?

python setup.py install 是我们用来安装下载的python包或者自己按照python官方规范开发的扩展包的常用指令。

通过这个命令,这个python包就会被安装系统或者你指定用户的python库里(这个操作在官方文档较module distribution.:http://structure.usc.edu/python/inst/standard-install.htm)

python setup.py install包括两步:

python setup.py build, python setup.py install,这两步,可分开执行, 也可只执行python setup.py install, 因为python setup.py install总是会先build后install. 

立即学习“Python免费学习笔记(深入)”;

python setup.py build 是python编译这个module的过程, 这个过程比较复杂,最后会生成build文件夹。除去build过程后的install过程,就是复制build/lib文件到用户指定的lib库。

这里以安装同事开发定制化的mock-server到系统python库为例进行试验。

初始条件:

 python-devel,gcc 已安装, mock-server原码包已下载和解压。

python setup.py install 是我们用来安装下载的python包或者自己按照python官方规范开发的扩展包的常用指令。

通过这个命令,这个python包就会被安装系统或者你指定用户的python库里(这个操作在官方文档较module distribution.:http://structure.usc.edu/python/inst/standard-install.htm)

python setup.py install包括两步:

python setup.py build, python setup.py install,这两步,可分开执行, 也可只执行python setup.py install, 因为python setup.py install总是会先build后install. 

立即学习“Python免费学习笔记(深入)”;

python setup.py build 是python编译这个module的过程, 这个过程比较复杂,最后会生成build文件夹。除去build过程后的install过程,就是复制build/lib文件到用户指定的lib库。

相关推荐:《Python教程》

以上就是python setup.py install是什么意思的详细内容,更多请关注php中文网其它相关文章!

关于Python-什么是setup.py?python中的setup的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于ERROR: Command "python setup.py egg_info" python-nss、pip 无法导入 Cython 但 python setup.py install 可以、Python Setup.py、python setup.py install是什么意思等相关知识的信息别忘了在本站进行查找喔。

本文标签: