简体   繁体   中英

Is there a proper way to install tensorflow in Blender using python console?

MY setup:

Blender 2.82

Python 3.7.4

I am trying to pip install tensorflow in blender

 **pip.main(['install','tensorflow'])**

However i receive this error and the tensorflow is not installing.

 Collecting tensorflow
      Using cached tensorflow-2.1.0-cp37-cp37m-win_amd64.whl (355.8 MB)
      Collecting keras-preprocessing>=1.1.0
         Using cached Keras_Preprocessing-1.1.0-py2.py3-none-any.whl (41 kB)
      Collecting protobuf>=3.8.0
        Downloading protobuf-3.11.3-cp37-cp37m-win_amd64.whl (1.0 MB)
      Collecting wheel>=0.26; python_version >= "3"
        Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
      Collecting tensorboard<2.2.0,>=2.1.0
        Downloading tensorboard-2.1.1-py3-none-any.whl (3.8 MB)
      Collecting google-pasta>=0.1.6
        Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)
      Collecting astor>=0.6.0
        Using cached astor-0.8.1-py2.py3-none-any.whl (27 kB)
      Collecting opt-einsum>=2.3.2
        Downloading opt_einsum-3.2.0-py3-none-any.whl (63 kB)
      Collecting tensorflow-estimator<2.2.0,>=2.1.0rc0
        Downloading tensorflow_estimator-2.1.0-py2.py3-none-any.whl (448 kB)
      Collecting termcolor>=1.1.0
        Using cached termcolor-1.1.0.tar.gz (3.9 kB)
      1

      WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.


     To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
       ERROR: Command errored out with exit status 1:
             command: 'C:\Program Files\Blender Foundation\Blender 2.82\blender.exe' -c 'import sys, 
         setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TB\\AppData\\Local\\Temp\\pip-install- 
         l65a801l\\termcolor\\setup.py'"'"'; __file__='"'"'C:\\Users\\TB\\AppData\\Local\\Temp\\pip- 
         install-l65a801l\\termcolor\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open) 
         (__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, 
         __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\TB\AppData\Local\Temp\pip-install- 
         l65a801l\termcolor\pip-egg-info'
         cwd: C:\Users\TB\AppData\Local\Temp\pip-install-l65a801l\termcolor\
         Complete output (9 lines):
           Read prefs: C:\Users\TB\AppData\Roaming\Blender Foundation\Blender\2.82\config\userpref.blend
         found bundled python: C:\Program Files\Blender Foundation\Blender 2.82\2.82\python
         unknown argument, loading as file: -c
         Error: Cannot read file 'C:\Users\TB\AppData\Local\Temp\pip-install-l65a801l\termcolor\-c': No 
      such file or directory
         Error: argument has no '.blend' file extension, not using as new file, exiting! 
            C:\Users\TB\AppData\Local\Temp\pip-install-l65a801l\termcolor\-c
         Saved session recovery to 'C:\Users\TB\AppData\Local\Temp\quit.blend'
         Warning: property 'release_confirm' not found in keymap item 'OperatorProperties'

    Blender quit

     ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. 

I tried also with other version of blender but going to a lower version of blender means a lower version of python. I need to use a higher version if i want to be able to use tensorflow.

Steps that solved my issue: - set the path of blender's python in environment variables: C:\\Program Files\\Blender Foundation\\Blender 2.82\\2.82\\python\\bin - where exe is located C:\\Program Files\\Blender Foundation\\Blender 2.82\\2.82\\python\\Scripts - go to python.exe folder in blender and start powershell - run ./python.exe -m pip install tensorflow==2.0

After these steps i was able to use tensorflow in Blender.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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