Anaconda pip离线安装,包括依赖项(tensorflow) [英] Anaconda pip offline installation including dependencies (tensorflow)

查看:1063
本文介绍了Anaconda pip离线安装,包括依赖项(tensorflow)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在没有Internet连接且没有root访问权限的系统上的anaconda环境中安装tensorflow(即我只想将其安装到本地用户)

我已经下载了tensorflow的.whl文件和所需的依赖项,并将它们复制到了我想使用的机器上.进入anaconda环境后,我便开始使用

安装软件包

pip install -b working_directory/build -t working_directory/target package.whl

但是当我想安装依赖于较早安装的软件包的软件包时,找不到它.

所以我想知道,如何告诉pip在哪里查找依赖项?我可以以更简单的方式安装tensorflow,仍然离线并且没有root用户吗?

解决方案

我正在使用PyCharm进行anaconda开发.使用conda安装tensorflow时我也遇到问题,我还安装了python 3.6并使用了tensorflow网站上给出的步骤.但是最后我使用以下步骤解决了这个问题,并使其在pyCharm上可以正常工作:

步骤1:我下载了tensorflow的二进制文件(.whl)(二进制文件的链接在git页面上给出 https://github.com/tensorflow/tensorflow )

第2步:然后我使用以下命令脱机安装了tensorflow:

pip.exe install --upgrade --no-deps C:\Important_Software\tensorflow-1.3.0rc0-cp36-cp36m-win_amd64.whl

步骤3:然后在以下位置创建了Tensorflow文件:

C:\Program Files\Python36\Lib\site-packages

我复制了这些文件,并将其粘贴到Anaconda网站包(Anaconda3 \ Lib \ site-packages)中.

第4步:安装了Tensorflow,但运行基本程序时出现以下错误:

  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'

第5步:我使用协议缓冲区的pip安装解决了该错误

pip.exe install --upgrade --no-deps "C:\TarFile_location\protobuf-3.3.0.tar.gz"

第6步:在这3个文件"protobuf-3.3.0-py3.6-nspkg.pth","protobuf-3.3.0-py3.6.egg-info"和"google"之后,分别在下面创建位置:

C:\Program Files\Python36\Lib\site-packages

这三个文件应粘贴在Anaconda网站软件包中. (Anaconda3 \ Lib \ site-packages)

第6步:我运行了以下程序并成功运行:

  import tensorflow as tf
  hello = tf.constant('Hello, TensorFlow!')
  sess = tf.Session()
  print(sess.run(hello))

如果仍然存在一些错误,则必须从 解决方案

I am using PyCharm for the development with anaconda. I was also facing issue while installing tensorflow using conda, I also installed the python 3.6 and used the steps given on the tensorflow website. But finally I solved this using below steps and made it work on pyCharm:

Step 1: I downloaded binaries (.whl) file of tensorflow (The links of binaries are given on the git page https://github.com/tensorflow/tensorflow)

Step 2: Then I installed the tensorflow offline using below command:

pip.exe install --upgrade --no-deps C:\Important_Software\tensorflow-1.3.0rc0-cp36-cp36m-win_amd64.whl

Step 3: Then Tensorflow files have been created at below location:

C:\Program Files\Python36\Lib\site-packages

I copied these files and pasted in the Anaconda site-packages (Anaconda3\Lib\site-packages).

Step 4: Tensorflow is installed but below error has come when running the basic program:

  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'

Step 5: I have solved this error using pip installation of protocol buffer

pip.exe install --upgrade --no-deps "C:\TarFile_location\protobuf-3.3.0.tar.gz"

Step 6: After this 3 files "protobuf-3.3.0-py3.6-nspkg.pth", "protobuf-3.3.0-py3.6.egg-info" and "google" are created at the below location:

C:\Program Files\Python36\Lib\site-packages

These three file should be pasted at the Anaconda site-packages. (Anaconda3\Lib\site-packages)

Step 6: The I ran the below program and It worked:

  import tensorflow as tf
  hello = tf.constant('Hello, TensorFlow!')
  sess = tf.Session()
  print(sess.run(hello))

If there will be still some Errors then all dependencies have to be downloaded and installed similar as step 2 or 5 from https://pypi.python.org/pypi/tensorflow. Important note: I was using the Windows command prompt with admin Access.

这篇关于Anaconda pip离线安装,包括依赖项(tensorflow)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆