UsingNet / nvjpeg-python

nvjpeg for python
MIT License
91 stars 24 forks source link

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

Open nistarlwc opened 1 year ago

nistarlwc commented 1 year ago

现在得把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__
astro-jingtao commented 7 months ago

我也是在虚拟环境安装,使用 pip install -e . 没有遇到这个问题。