Skip to content

怎么在anaconda虚拟环境里面安装? #20

@nistarlwc

Description

@nistarlwc

现在得把cuda和NvJpeg都安装到anaconda里方便复制环境。
cuda可以通过conda安装,直接都安装到cuda的虚拟环境里面了。
现在就差这个库怎么安装到cuda的虚拟环境里了。
我尝试修改了代码:

elif platform.system() == 'Windows':
    cuda_include = 'C:\\Anaconda3\\envs\\onnx\\include'
    if platform.machine().endswith('64'):
        cuda_lib = 'C:\\Anaconda3\\envs\\onnx\\Lib\\x64'
    else:
        cuda_lib = 'C:\\Anaconda3\\envs\\onnx\\Lib\\Win32'
    extension_nvjpeg = Extension('nvjpeg', 
        ['nvjpeg-python.cpp', 'src\\x86\\JpegCoder.cpp'], 
        ['include', numpy.get_include(), cuda_include], 
        [('JPEGCODER_ARCH', 'x86')],
        library_dirs=[cuda_lib],
    )

我以为将cuda地址换掉就可以了,python .\setup.py build 是通过了。但是python .\setup.py install报错

C:\Anaconda3\envs\onnx\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
C:\Anaconda3\envs\onnx\lib\site-packages\setuptools\_distutils\cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
warning: no files found matching 'src\**'
zip_safe flag not set; analyzing archive contents...
__pycache__.nvjpeg.cpython-38: module references __file__

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions