我有windows 10。我已经完成Tensorflow的安装。它的工作原理。上面写着“你好,Tensorflow!”但这一切都摆在它面前:

2018-08-18 18:16:01.500579: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 
2018-08-18 18:16:01.769002: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 0 with properties: name: GeForce GTX 950 major: 5 minor: 2 memoryClockRate(GHz): 1.3545 pciBusID: 0000:01:00.0 totalMemory: 2.00GiB freeMemory: 1.64GiB 
2018-08-18 18:16:01.774030: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1484] Adding visible gpu devices: 0 
2018-08-18 18:16:02.095489: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix: 
2018-08-18 18:16:02.099093: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0 
2018-08-18 18:16:02.100631: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 0: N 
2018-08-18 18:16:02.102156: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1401 MB memory) -> physical GPU (device: 0, name: GeForce GTX 950, pci bus id: 0000:01:00.0, compute capability: 5.2) Hello Tensorflow!

Process returned 0 (0x0) execution time : 2.327 s Press any key to continue

当我在cmb中输入pip3 install——upgrade tensorflow-gpu时,无论是管理的还是正常的,我都得到了这个:

Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\users\\dylan\\appdata\\local\\programs\\python\\python35\\Lib\\site-packages\\numpy\\.libs\\libopenblas.BNVRK7633HSX7YVO2TADGR4A5KEKXJAW.gfortran-win_amd64.dll'
Consider using the `--user` option or check the permissions.

请帮帮我。不是计算机科学家或工程师。但我编程只是为了好玩。


当前回答

使用——user执行相同的命令。

其他回答

我在添加Flask时也遇到了同样的问题。 因此使用上面的命令之一。

PIP install——ignore-installed——upgrade——user flask

只有一个小警告,它工作!!

Installing collected packages: click, MarkupSafe, Jinja2, itsdangerous, Werkzeug, flask WARNING: The script flask.exe is installed in 'C:\Users\Admin\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.2 flask-1.1.2 itsdangerous-1.1.0 WARNING: You are using pip version 20.1.1; however, version 20.2 is available. You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.

在我的例子中,我禁用了McAfee,然后成功安装了tensorflow2.0 RC

当所有上述方法都失败时,我能够按照官方网站https://scikit-learn.org/stable/install.html的说明安装scikit-learn。

Windows上文件路径长度限制导致的错误

如果Python安装在用户主目录下的AppData文件夹结构等嵌套位置,则在达到Windows默认路径大小限制时,pip可能无法安装包,例如:

Collecting scikit-learn
...
Installing collected packages: scikit-learn
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\username\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python37\\site-packages\\sklearn\\datasets\\tests\\data\\openml\\292\\api-v1-json-data-list-data_name-australian-limit-2-data_version-1-status-deactivated.json.gz'

在这种情况下,可以通过使用regedit工具解除Windows注册表中的限制:

在Windows开始菜单中输入“regedit”启动regedit。

打开“Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem”键。

编辑该键的LongPathsEnabled属性的值,并将其设置为1。

重新安装scikit-learn(忽略之前失败的安装):

PIP install——exists-action=i scikit-learn

在windows中试试这个:

pip install -U <Package_Name>

使用——user执行相同的命令。