Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 谷歌云虚拟机-安装openCV_Python_Google App Engine_Opencv_Google Cloud Platform_Dockerfile - Fatal编程技术网

Python 谷歌云虚拟机-安装openCV

Python 谷歌云虚拟机-安装openCV,python,google-app-engine,opencv,google-cloud-platform,dockerfile,Python,Google App Engine,Opencv,Google Cloud Platform,Dockerfile,我使用Google App Engine和Python来托管一些后端脚本并在数据存储中存储数据,我需要利用openCV进行一些更高级的媒体操作 我正在尝试切换到谷歌云虚拟机平台,但我在理解如何安装openCV方面遇到了困难 今天早些时候,我在VM Cloud Shell上尝试了: sudo apt-get install python-opencv 这似乎是可行的,在列出我的python模块之后,我得到了: help> modules Please wait a moment whil

我使用Google App Engine和Python来托管一些后端脚本并在数据存储中存储数据,我需要利用openCV进行一些更高级的媒体操作

我正在尝试切换到谷歌云虚拟机平台,但我在理解如何安装openCV方面遇到了困难

今天早些时候,我在VM Cloud Shell上尝试了:

sudo apt-get install python-opencv
这似乎是可行的,在列出我的python模块之后,我得到了:

help> modules

Please wait a moment while I gather a list of all available modules...

/usr/local/lib/python2.7/dist-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated. You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)
BaseHTTPServer      audiodev            importlib           setuptools
Bastion             audioop             imputil             sgmllib
CDROM               autoreload          inspect             sha
CGIHTTPServer       base64              io                  shelve
Canvas              bdb                 ipython_genutils    shlex
ConfigParser        binascii            itertools           shutil
Cookie              binhex              json                signal
DLFCN               bisect              keyword             simplegeneric
Dialog              bsddb               lib2to3             site
DocXMLRPCServer     bz2                 linecache           sitecustomize
FileDialog          cPickle             linuxaudiodev       six
FixTk               cProfile            locale              smtpd
HTMLParser          cStringIO           logging             smtplib
IN                  calendar            macpath             sndhdr
IPython             cgi                 macurl2path         socket
MimeWriter          cgitb               mailbox             spwd
Queue               chardet             mailcap             sqlite3
ScrolledText        chunk               markupbase          sre
SimpleDialog        cmath               marshal             sre_compile
SimpleHTTPServer    cmd                 math                sre_constants
SimpleXMLRPCServer  code                md5                 sre_parse
SocketServer        codecs              meld3               ssl
StringIO            codeop              mercurial           stat
TYPES               collections         mhlib               statvfs
Tix                 colorama            mimetools           storemagic
Tkconstants         colorsys            mimetypes           string
Tkdnd               commands            mimify              stringold
Tkinter             compileall          mmap                stringprep
UserDict            compiler            modulefinder        strop
UserList            contextlib          multifile           struct
UserString          cookielib           multiprocessing     subprocess
_LWPCookieJar       copy                mutex               sunau
_MozillaCookieJar   copy_reg            netrc               sunaudio
__builtin__         crcmod              new                 supervisor
__future__          crypt               nis                 symbol
_abcoll             csv                 nntplib             sympyprinting
_ast                ctypes              ntpath              symtable
_bisect             curses              nturl2path          sys
_bsddb              cv                  numbers             sysconfig
_codecs             cv2                 numpy               syslog
_codecs_cn          cythonmagic         oauth2client        tabnanny
_codecs_hk          datetime            opcode              tarfile
_codecs_iso2022     dbhash              operator            telnetlib
_codecs_jp          dbm                 optparse            tempfile
_codecs_kr          debconf             os                  termios
_codecs_tw          decimal             os2emxpath          test
_collections        decorator           ossaudiodev         test_path
_csv                difflib             parser              tests
_ctypes             dircache            path                textwrap
_ctypes_test        dis                 pdb                 this
_curses             distlib             pexpect             thread
_curses_panel       distutils           pickle              threading
_elementtree        doctest             pickleshare         time
_functools          dumbdbm             pickletools         timeit
_hashlib            dummy_thread        pip                 tkColorChooser
_heapq              dummy_threading     pipes               tkCommonDialog
_hotshot            easy_install        pkg_resources       tkFileDialog
_io                 email               pkgutil             tkFont
_json               encodings           platform            tkMessageBox
_locale             ensurepip           plistlib            tkSimpleDialog
_lsprof             errno               popen2              toaiff
DocXMLRPCServer     bz2                 linecache           sitecustomize
_markerlib          exceptions          poplib              token
_md5                fcntl               posix               tokenize
_multibytecodec     filecmp             posixfile           trace
_multiprocessing    fileinput           posixpath           traceback
_osx_support        fnmatch             pprint              traitlets
_pyio               formatter           profile             ttk
_random             fpectl              pstats              tty
_sha                fpformat            pty                 turtle
_sha256             fractions           ptyprocess          types
_sha512             ftplib              pwd                 unicodedata
_socket             functools           py_compile          unittest
_sqlite3            future_builtins     pyasn1              urllib
_sre                gc                  pyasn1_modules      urllib2
_ssl                genericpath         pyclbr              urllib3
_strptime           getopt              pydoc               urlparse
_struct             getpass             pydoc_data          user
_symtable           gettext             pyexpat             uu
如您所见,cv和cv2已列出。然后我试着:

>>> from cv2 import *
我也试过:

>>> import cv2
两者似乎都正确地导入了模块

然而,数小时后,我再次尝试导入cv2,但未找到,因此我再次运行模块检查,并得到:

help> modules

Please wait a moment while I gather a list of all available modules...

/usr/local/lib/python2.7/dist-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated. You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)
BaseHTTPServer      base64              jinja2              sets
Bastion             bdb                 json                setuptools
CDROM               binascii            jsonschema          sgmllib
CGIHTTPServer       binhex              jupyter             sha
Canvas              bisect              jupyter_client      shelve
ConfigParser        bsddb               jupyter_console     shlex
Cookie              bz2                 jupyter_core        shutil
DLFCN               cPickle             keyword             signal
Dialog              cProfile            lib2to3             simplegeneric
DocXMLRPCServer     cStringIO           linecache           singledispatch
FileDialog          calendar            linuxaudiodev       singledispatch_helpers
FixTk               certifi             locale              site
HTMLParser          cgi                 logging             sitecustomize
IN                  cgitb               macpath             six
IPython             chardet             macurl2path         smtpd
MimeWriter          chunk               mailbox             smtplib
Queue               cmath               mailcap             sndhdr
ScrolledText        cmd                 markupbase          socket
SimpleDialog        code                markupsafe          spwd
SimpleHTTPServer    codecs              marshal             sqlite3
SimpleXMLRPCServer  codeop              math                sre
SocketServer        collections         md5                 sre_compile
StringIO            colorama            meld3               sre_constants
TYPES               colorsys            mercurial           sre_parse
Tix                 commands            mhlib               ssl
Tkconstants         compileall          mimetools           stat
Tkdnd               compiler            mimetypes           statvfs
Tkinter             contextlib          mimify              storemagic
UserDict            cookielib           mistune             string
UserList            copy                mmap                stringold
UserString          copy_reg            modulefinder        stringprep
_LWPCookieJar       crcmod              multifile           strop
_MozillaCookieJar   crypt               multiprocessing     struct
__builtin__         csv                 mutex               subprocess
__future__          ctypes              nbconvert           sunau
_abcoll             curses              nbformat            sunaudio
_ast                cythonmagic         netrc               supervisor
_bisect             datetime            new                 symbol
_bsddb              dbhash              nis                 sympyprinting
_codecs             dbm                 nntplib             symtable
_codecs_cn          debconf             notebook            sys
_codecs_hk          decimal             ntpath              sysconfig
_codecs_iso2022     decorator           nturl2path          syslog
_codecs_jp          difflib             numbers             tabnanny
_codecs_kr          dircache            oauth2client        tarfile
_codecs_tw          dis                 opcode              telnetlib
_collections        distlib             operator            tempfile
_csv                distutils           optparse            terminado
_ctypes             doctest             os                  termios
_ctypes_test        dumbdbm             os2emxpath          test
_curses             dummy_thread        ossaudiodev         test_path
_curses_panel       dummy_threading     parser              tests
_elementtree        easy_install        path                textwrap
_functools          email               pdb                 this
_hashlib            encodings           pexpect             thread
_heapq              ensurepip           pickle              threading
_hotshot            errno               pickleshare         time
_io                 exceptions          pickletools         timeit
_json               fcntl               pip                 tkColorChooser
_locale             filecmp             pipes               tkCommonDialog
_lsprof             fileinput           pkg_resources       tkFileDialog
_markerlib          fnmatch             pkgutil             tkFont
_md5                formatter           platform            tkMessageBox
_multibytecodec     fpectl              plistlib            tkSimpleDialog
_multiprocessing    fpformat            popen2              toaiff
_osx_support        fractions           poplib              token
_pyio               ftplib              posix               tokenize
_random             functools           posixfile           tornado
_sha                functools32         posixpath           trace
_sha256             future_builtins     pprint              traceback
_sha512             gc                  profile             traitlets
_socket             genericpath         pstats              ttk
_sqlite3            getopt              pty                 tty
_sre                getpass             ptyprocess          turtle
_ssl                gettext             pwd                 types
_strptime           glob                py_compile          unicodedata
Canvas              bisect              jupyter_client      shelve
_struct             grp                 pyasn1              unittest
_symtable           gzip                pyasn1_modules      urllib
_sysconfigdata      hashlib             pyclbr              urllib2
_sysconfigdata_nd   heapq               pydoc               urllib3
_testcapi           hgext               pydoc_data          urlparse
_threading_local    hmac                pyexpat             user
_warnings           hotshot             pygments            uu
_weakref            html5lib            qtconsole           uuid
_weakrefset         htmlentitydefs      quopri              warnings
abc                 htmllib             random              wave
aifc                httplib             re                  weakref
antigravity         httplib2            readline            webbrowser
anydbm              ihooks              repr                whichdb
argparse            imaplib             requests            wsgiref
array               imghdr              resource            xdrlib
ast                 imp                 rexec               xml
asynchat            importlib           rfc822              xmllib
asyncore            imputil             rlcompleter         xmlrpclib
atexit              inspect             rmagic              xxsubtype
audiodev            io                  robotparser         zipfile
audioop             ipykernel           rsa                 zipimport
autoreload          ipython_genutils    runpy               zlib
backports           ipywidgets          sched               zmq
backports_abc       itertools           select              
我的openCV安装怎么了

如果有人知道关于如何正确安装openCV并将其导入我的python脚本的完整文档帮助,请发布该链接!我从谷歌云文档中知道,我应该能够在我的虚拟机上使用openCV

对于如何设置Dockerfile和requirements.txt文件以正确使用openCV,有一些更详细的说明也会很有帮助。同样,上面链接的谷歌云文档中也提到了这一点,但从未详细解释过

谢谢

只是一个正在运行的。这是一种快速运行gcloud命令的方法,可以与您的谷歌云项目资源进行交互和管理。但它不包含实际的项目资源

云Shell的会话仅在处于活动状态时保持,并在一小时不活动后终止。因此,在Cloud Shell虚拟机上导入openCV完全独立于您的项目,并且不会以任何方式持久化到该项目

为了将openCV应用程序部署到应用程序引擎,您需要使用openCV应用程序目录中的“”命令


作为openCV的一种替代方案,我们现在提供了一种为您的应用程序提供分析图像、视频、语音、文本等功能的方法

如果安装在主目录中,它不会持续存在吗?是的,如果使用,它将在会话之间持续存在。尽管如果您不定期访问Cloud Shell,$HOME directory持久存储可能会被回收,正如文档中所述。@Jordan当您提到定期
的确切时间范围时,
文档中没有提到定期意味着什么的确切时间范围