久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='NdURg'></small><noframes id='NdURg'>

    1. <legend id='NdURg'><style id='NdURg'><dir id='NdURg'><q id='NdURg'></q></dir></style></legend>
      <tfoot id='NdURg'></tfoot>
      <i id='NdURg'><tr id='NdURg'><dt id='NdURg'><q id='NdURg'><span id='NdURg'><b id='NdURg'><form id='NdURg'><ins id='NdURg'></ins><ul id='NdURg'></ul><sub id='NdURg'></sub></form><legend id='NdURg'></legend><bdo id='NdURg'><pre id='NdURg'><center id='NdURg'></center></pre></bdo></b><th id='NdURg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NdURg'><tfoot id='NdURg'></tfoot><dl id='NdURg'><fieldset id='NdURg'></fieldset></dl></div>
        <bdo id='NdURg'></bdo><ul id='NdURg'></ul>
    2. 點(diǎn)安裝.僅創(chuàng)建 dist-info 而不是包

      pip install . creates only the dist-info not the package(點(diǎn)安裝.僅創(chuàng)建 dist-info 而不是包)
    3. <legend id='Y8fOd'><style id='Y8fOd'><dir id='Y8fOd'><q id='Y8fOd'></q></dir></style></legend>
        <tbody id='Y8fOd'></tbody>
    4. <small id='Y8fOd'></small><noframes id='Y8fOd'>

      <i id='Y8fOd'><tr id='Y8fOd'><dt id='Y8fOd'><q id='Y8fOd'><span id='Y8fOd'><b id='Y8fOd'><form id='Y8fOd'><ins id='Y8fOd'></ins><ul id='Y8fOd'></ul><sub id='Y8fOd'></sub></form><legend id='Y8fOd'></legend><bdo id='Y8fOd'><pre id='Y8fOd'><center id='Y8fOd'></center></pre></bdo></b><th id='Y8fOd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Y8fOd'><tfoot id='Y8fOd'></tfoot><dl id='Y8fOd'><fieldset id='Y8fOd'></fieldset></dl></div>

              <bdo id='Y8fOd'></bdo><ul id='Y8fOd'></ul>
                <tfoot id='Y8fOd'></tfoot>

                本文介紹了點(diǎn)安裝.僅創(chuàng)建 dist-info 而不是包的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我正在嘗試制作一個(gè)我想在本地使用 pip install . 安裝的 python 包.包名稱在 pip freeze 中列出,但 import <package> 會(huì)導(dǎo)致錯(cuò)誤 No module named <package>.此外,site-packages 文件夾僅包含 dist-info 文件夾.find_packages() 能夠找到包.我錯(cuò)過了什么?

                I am trying to make a python package which I want to install using pip install . locally. The package name is listed in pip freeze but import <package> results in an error No module named <package>. Also the site-packages folder does only contain a dist-info folder. find_packages() is able to find packages. What am I missing?

                import io
                import os
                import sys
                from shutil import rmtree
                
                from setuptools import find_packages, setup, Command
                
                # Package meta-data.
                NAME = '<package>'
                DESCRIPTION = 'description'
                URL = ''
                EMAIL = 'email'
                AUTHOR = 'name'
                
                # What packages are required for this module to be executed?
                REQUIRED = [
                    # 'requests', 'maya', 'records',
                ]
                
                # The rest you shouldn't have to touch too much :)
                # ------------------------------------------------
                # Except, perhaps the License and Trove Classifiers!
                # If you do change the License, remember to change the Trove Classifier for that!
                
                here = os.path.abspath(os.path.dirname(__file__))
                
                
                
                # Where the magic happens:
                setup(
                    name=NAME,
                    #version=about['__version__'],
                    description=DESCRIPTION,
                    # long_description=long_description,
                    author=AUTHOR,
                    author_email=EMAIL,
                    url=URL,
                    packages=find_packages(),
                    # If your package is a single module, use this instead of 'packages':
                    # py_modules=['mypackage'],
                
                    # entry_points={
                    #     'console_scripts': ['mycli=mymodule:cli'],
                    # },
                    install_requires=REQUIRED,
                    include_package_data=True,
                    license='MIT',
                    classifiers=[
                        # Trove classifiers
                        # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
                        'License :: OSI Approved :: MIT License',
                        'Programming Language :: Python',
                        'Programming Language :: Python :: 2.6',
                        'Programming Language :: Python :: 2.7',
                        'Programming Language :: Python :: 3',
                        'Programming Language :: Python :: 3.3',
                        'Programming Language :: Python :: 3.4',
                        'Programming Language :: Python :: 3.5',
                        'Programming Language :: Python :: 3.6',
                        'Programming Language :: Python :: Implementation :: CPython',
                        'Programming Language :: Python :: Implementation :: PyPy'
                    ],
                
                )
                

                推薦答案

                由于這個(gè)問題已經(jīng)變得非常流行,這里是安裝后丟失文件時(shí)的診斷步驟.想象有一個(gè)具有以下結(jié)構(gòu)的示例項(xiàng)目:

                Since the question has become quite popular, here are the diagnosis steps to go through when you're missing files after installation. Imagine having an example project with the following structure:

                root
                ├── spam
                │   ├── __init__.py
                │   ├── data.txt
                │   ├── eggs.py
                │   └── fizz
                │       ├── __init__.py
                │       └── buzz.py
                ├── bacon.py
                └── setup.py
                

                現(xiàn)在我運(yùn)行 pip install .,檢查包是否已安裝:

                Now I run pip install ., check that the package is installed:

                $ pip list
                Package    Version
                ---------- -------
                mypkg      0.1    
                pip        19.0.1 
                setuptools 40.6.3 
                wheel      0.32.3 
                

                但看不到 spamspam/eggs.pybacon.pyspam/fizz/buzz.py 在屬于已安裝包的文件列表中:

                but see neither spam, nor spam/eggs.py nor bacon.py nor spam/fizz/buzz.py in the list of files belonging to the installed package:

                $ pip show -f mypkg
                Name: mypkg
                Version: 0.1
                ...
                Files:
                  mypkg-0.1.dist-info/DESCRIPTION.rst
                  mypkg-0.1.dist-info/INSTALLER
                  mypkg-0.1.dist-info/METADATA
                  mypkg-0.1.dist-info/RECORD
                  mypkg-0.1.dist-info/WHEEL
                  mypkg-0.1.dist-info/metadata.json
                  mypkg-0.1.dist-info/top_level.txt
                

                那么現(xiàn)在該怎么辦?

                除非被告知不要這樣做,pip 將始終嘗試構(gòu)建一個(gè) wheel 文件并從中安裝您的包.如果在詳細(xì)模式下重新安裝,我們可以檢查輪子構(gòu)建過程的日志.第一步是卸載包:

                Unless told not to do so, pip will always try to build a wheel file and install your package from it. We can inspect the log for the wheel build process if reinstalling in the verbose mode. First step is to uninstall the package:

                $ pip uninstall -y mypkg
                ...
                

                然后再次安裝它,但現(xiàn)在有一個(gè)額外的參數(shù):

                then install it again, but now with an additional argument:

                $ pip install . -vvv
                ...
                

                現(xiàn)在如果我檢查日志:

                $ pip install . -vvv | grep 'adding'
                  adding 'mypkg-0.1.dist-info/METADATA'
                  adding 'mypkg-0.1.dist-info/WHEEL'
                  adding 'mypkg-0.1.dist-info/top_level.txt'
                  adding 'mypkg-0.1.dist-info/RECORD'
                

                我注意到在任何地方都沒有提到 spam 目錄或 bacon.py 中的文件.這意味著它們根本沒有包含在輪文件中,因此沒有被 pip 安裝.最常見的錯(cuò)誤來源是:

                I notice that no files from the spam directory or bacon.py are mentioned anywhere. This means they were simply not included in the wheel file and hence not installed by pip. The most common error sources are:

                驗(yàn)證您已將 packages 參數(shù)傳遞給 setup 函數(shù).檢查您是否提到了應(yīng)該安裝的所有包.如果只提到父包,子包不會(huì)被自動(dòng)收集!例如,在設(shè)置腳本中

                Verify you have passed the packages argument to the setup function. Check that you have mentioned all of the packages that should be installed. Subpackages will not be collected automatically if only the parent package is mentioned! For example, in the setup script

                from setuptools import setup
                
                setup(
                    name='mypkg',
                    version='0.1',
                    packages=['spam']
                )
                

                spam 將被安裝,而不是 spam.fizz 因?yàn)樗旧砭褪且粋€(gè)包,必須明確提及.修復(fù)它:

                spam will be installed, but not spam.fizz because it is a package itself and must be mentioned explicitly. Fixing it:

                from setuptools import setup
                
                setup(
                    name='mypkg',
                    version='0.1',
                    packages=['spam', 'spam.fizz']
                )
                

                如果您有很多包,請(qǐng)使用 setuptools.find_packages 自動(dòng)執(zhí)行該過程:

                If you have lots of packages, use setuptools.find_packages to automate the process:

                from setuptools import find_packages, setup
                
                setup(
                    name='mypkg',
                    version='0.1',
                    packages=find_packages()  # will return a list ['spam', 'spam.fizz']
                )
                

                如果您缺少模塊:

                在上面的例子中,我會(huì)在安裝后丟失 bacon.py,因?yàn)樗粚儆谌魏伟?我必須在單獨(dú)的參數(shù) py_modules 中提供其模塊名稱:

                In the above examples, I will be missing bacon.py after installation since it doesn't belong to any package. I have to provide its module name in the separate argument py_modules:

                from setuptools import find_packages, setup
                
                setup(
                    name='mypkg',
                    version='0.1',
                    packages=find_packages(),
                    py_modules=['bacon']
                )
                

                缺少數(shù)據(jù)文件:檢查 package_data 參數(shù)

                我現(xiàn)在已經(jīng)準(zhǔn)備好所有的源代碼文件,但是 data.txt 文件仍然沒有安裝.應(yīng)通過 package_data 參數(shù)添加位于包目錄下的數(shù)據(jù)文件.修復(fù)上述設(shè)置腳本:

                Missing data files: check the package_data argument

                I have all the source code files in place now, but the data.txt file is still not installed. Data files located under package directories should be added via the package_data argument. Fixing the above setup script:

                from setuptools import find_packages, setup
                
                setup(
                    name='mypkg',
                    version='0.1',
                    packages=find_packages(),
                    package_data={'spam': ['data.txt']},
                    py_modules=['bacon']
                )
                

                不要試圖使用 data_files 參數(shù).將數(shù)據(jù)文件放在一個(gè)包下,然后配置 package_data.

                Don't be tempted to use the data_files argument. Place the data files under a package and configure package_data instead.

                如果我現(xiàn)在重新安裝軟件包,我會(huì)注意到所有文件都添加到了輪子中:

                If I now reinstall the package, I will notice all of the files are added to the wheel:

                $ pip install . -vvv | grep 'adding'
                  adding 'bacon.py'
                  adding 'spam/__init__.py'
                  adding 'spam/data.txt'
                  adding 'spam/eggs.py'
                  adding 'spam/fizz/__init__.py'
                  adding 'spam/fizz/buzz.py'
                  adding 'mypkg-0.1.dist-info/METADATA'
                  adding 'mypkg-0.1.dist-info/WHEEL'
                  adding 'mypkg-0.1.dist-info/top_level.txt'
                  adding 'mypkg-0.1.dist-info/RECORD'
                

                它們也將在屬于 mypkg 的文件列表中可見:

                They will also be visible in the list of files belonging to mypkg:

                $ pip show -f mypkg
                Name: mypkg
                Version: 0.1
                ...
                Files:
                  __pycache__/bacon.cpython-36.pyc
                  bacon.py
                  mypkg-0.1.dist-info/INSTALLER
                  mypkg-0.1.dist-info/METADATA
                  mypkg-0.1.dist-info/RECORD
                  mypkg-0.1.dist-info/WHEEL
                  mypkg-0.1.dist-info/top_level.txt
                  spam/__init__.py
                  spam/__pycache__/__init__.cpython-36.pyc
                  spam/__pycache__/eggs.cpython-36.pyc
                  spam/data.txt
                  spam/eggs.py
                  spam/fizz/__init__.py
                  spam/fizz/__pycache__/__init__.cpython-36.pyc
                  spam/fizz/__pycache__/buzz.cpython-36.pyc
                  spam/fizz/buzz.py
                

                這篇關(guān)于點(diǎn)安裝.僅創(chuàng)建 dist-info 而不是包的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類)
                Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級(jí)名稱的情況下構(gòu)造python包)
                Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                How to refresh sys.path?(如何刷新 sys.path?)
                Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫的 Python 包)
                        <tbody id='32Rrt'></tbody>
                          <bdo id='32Rrt'></bdo><ul id='32Rrt'></ul>
                          <legend id='32Rrt'><style id='32Rrt'><dir id='32Rrt'><q id='32Rrt'></q></dir></style></legend>

                          <i id='32Rrt'><tr id='32Rrt'><dt id='32Rrt'><q id='32Rrt'><span id='32Rrt'><b id='32Rrt'><form id='32Rrt'><ins id='32Rrt'></ins><ul id='32Rrt'></ul><sub id='32Rrt'></sub></form><legend id='32Rrt'></legend><bdo id='32Rrt'><pre id='32Rrt'><center id='32Rrt'></center></pre></bdo></b><th id='32Rrt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='32Rrt'><tfoot id='32Rrt'></tfoot><dl id='32Rrt'><fieldset id='32Rrt'></fieldset></dl></div>

                          <small id='32Rrt'></small><noframes id='32Rrt'>

                        • <tfoot id='32Rrt'></tfoot>

                          主站蜘蛛池模板: 欧美一级片在线观看 | 日韩av一区二区在线观看 | 密桃av | 国产福利在线视频 | 国产一区二区精品在线观看 | 亚洲精品一区二区三区中文字幕 | 亚洲一区二区三区在线观看免费 | 精品一区二区三区在线观看 | 国产一区二区三区久久 | 全部免费毛片在线播放网站 | 国产一区二区在线视频 | 国产传媒视频在线观看 | 成人黄色在线视频 | 国产免费视频 | 伊人一区 | 色综合成人网 | 国产成人91视频 | 国产精品久久国产愉拍 | 一级黄色毛片子 | 亚洲一区中文字幕 | 黑人久久 | 亚洲视频三| 亚洲成av人片在线观看 | 亚洲午夜精品久久久久久app | 在线免费观看成人 | 亚洲精品久久久一区二区三区 | 日韩中文字幕 | 一级片子 | 亚洲精品视频免费观看 | 欧美a在线 | 亚洲欧洲色视频 | 正在播放国产精品 | 久久精品小视频 | 欧美久久一级 | 日本精品视频 | 日本h片在线观看 | h片免费在线观看 | 成年人在线观看视频 | 一区二区三区在线免费 | 国产精品视频入口 | 老司机精品福利视频 |