欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決Ubuntu18中的pycharm不能調(diào)用tensorflow-gpu的問(wèn)題

 更新時(shí)間:2020年09月17日 10:41:47   作者:AnswerThe  
這篇文章主要介紹了解決Ubuntu18中的pycharm不能調(diào)用tensorflow-gpu的問(wèn)題,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

問(wèn)題描述:我通過(guò)控制臺(tái)使用tensorflow-gpu沒(méi)問(wèn)題,但是通過(guò)pycharm使用卻不可以,如下所示:

通過(guò)控制臺(tái):

answer@answer-desktop:/$ python
Python 3.7.0 (default, Jun 28 2018, 13:15:42) 
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-02-04 21:37:12.964610: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/lib64
2020-02-04 21:37:12.964749: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/lib64
2020-02-04 21:37:12.964777: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
>>> print(tf.test.is_gpu_available())
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-02-04 21:37:37.267421: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 1795795000 Hz
2020-02-04 21:37:37.268461: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55913b67a840 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-02-04 21:37:37.268516: I tensorflow/compiler/xla/service/service.cc:176]  StreamExecutor device (0): Host, Default Version
2020-02-04 21:37:37.272139: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-02-04 21:37:37.481038: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-04 21:37:37.481712: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55913b6eb960 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-02-04 21:37:37.481755: I tensorflow/compiler/xla/service/service.cc:176]  StreamExecutor device (0): GeForce GTX 1060 3GB, Compute Capability 6.1
2020-02-04 21:37:37.482022: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-04 21:37:37.482528: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties: 
pciBusID: 0000:03:00.0 name: GeForce GTX 1060 3GB computeCapability: 6.1
coreClock: 1.7085GHz coreCount: 9 deviceMemorySize: 5.93GiB deviceMemoryBandwidth: 178.99GiB/s
2020-02-04 21:37:37.482953: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-02-04 21:37:37.485492: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2020-02-04 21:37:37.487486: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2020-02-04 21:37:37.487927: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2020-02-04 21:37:37.490469: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2020-02-04 21:37:37.491950: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
2020-02-04 21:37:37.499031: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-02-04 21:37:37.499301: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-04 21:37:37.500387: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-04 21:37:37.500847: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1697] Adding visible gpu devices: 0
2020-02-04 21:37:37.500941: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-02-04 21:37:37.502172: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-04 21:37:37.502212: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102]   0 
2020-02-04 21:37:37.502229: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] 0:  N 
2020-02-04 21:37:37.502436: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-04 21:37:37.503003: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-04 21:37:37.503593: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1241] Created TensorFlow device (/device:GPU:0 with 2934 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 3GB, pci bus id: 0000:03:00.0, compute capability: 6.1)
True
>>>

返回的True,說(shuō)明可以

通過(guò)pycharm卻不行,如下圖,返回False

解決辦法:

1.修改~/.bashrc

將pycahrm的路徑加到環(huán)境中,示例如下:

alias pycharm="bash /home/answer/文檔/pycharm-professional-2019.3.2/pycharm-2019.3.2/bin/pycharm.sh"

刷新生效:

source ~/.bashrc

2.修改pycharm中的環(huán)境變量

選擇pycharm 菜單欄Run ——> Run-Edit Configurations ——> Environment variables——> 將cuda的路徑加進(jìn)去 例如:LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64

在運(yùn)行就可以了

到此這篇關(guān)于解決Ubuntu18中的pycharm不能調(diào)用tensorflow-gpu的問(wèn)題的文章就介紹到這了,更多相關(guān)pycharm不能調(diào)用tensorflow-gpu內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Python aiohttp百萬(wàn)并發(fā)極限測(cè)試實(shí)例分析

    Python aiohttp百萬(wàn)并發(fā)極限測(cè)試實(shí)例分析

    這篇文章主要介紹了Python aiohttp百萬(wàn)并發(fā)極限測(cè)試,結(jié)合實(shí)例形式分析了Python異步編程基于aiohttp客戶端高并發(fā)請(qǐng)求的相關(guān)操作技巧與使用注意事項(xiàng),需要的朋友可以參考下
    2019-10-10
  • python實(shí)現(xiàn)tree命令的使用示例

    python實(shí)現(xiàn)tree命令的使用示例

    本文主要介紹了python實(shí)現(xiàn)tree命令的使用示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-09-09
  • Pillow圖像顏色處理的具體使用

    Pillow圖像顏色處理的具體使用

    Pillow 提供了顏色處理模塊 ImageColor,該模塊支持不同格式的顏色,可以修改RGB的顏色,具有一定的參考價(jià)值,感興趣的可以了解一下
    2021-11-11
  • 一篇文章搞懂Python的類與對(duì)象名稱空間

    一篇文章搞懂Python的類與對(duì)象名稱空間

    這篇文章主要給大家介紹了關(guān)于Python的類與對(duì)象名稱空間的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-12-12
  • 使用Python實(shí)現(xiàn)PDF頁(yè)面設(shè)置操作

    使用Python實(shí)現(xiàn)PDF頁(yè)面設(shè)置操作

    這篇文章主要為大家詳細(xì)介紹了如何使用Python實(shí)現(xiàn)PDF頁(yè)面設(shè)置操作,例如旋轉(zhuǎn)頁(yè)面和調(diào)整頁(yè)面順序,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-04-04
  • TensorFlow 滑動(dòng)平均的示例代碼

    TensorFlow 滑動(dòng)平均的示例代碼

    這篇文章主要介紹了TensorFlow 滑動(dòng)平均的示例代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-06-06
  • python實(shí)現(xiàn)監(jiān)控阿里云賬戶余額功能

    python實(shí)現(xiàn)監(jiān)控阿里云賬戶余額功能

    這篇文章主要介紹了python實(shí)現(xiàn)監(jiān)控阿里云賬戶余額功能,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-12-12
  • Python3利用Dlib實(shí)現(xiàn)攝像頭實(shí)時(shí)人臉檢測(cè)和平鋪顯示示例

    Python3利用Dlib實(shí)現(xiàn)攝像頭實(shí)時(shí)人臉檢測(cè)和平鋪顯示示例

    這篇文章主要介紹了Python3利用Dlib實(shí)現(xiàn)攝像頭實(shí)時(shí)人臉檢測(cè)和平鋪顯示示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-02-02
  • Python圖像處理庫(kù)PIL的ImageEnhance模塊使用介紹

    Python圖像處理庫(kù)PIL的ImageEnhance模塊使用介紹

    這篇文章主要介紹了Python圖像處理庫(kù)PIL的ImageEnhance模塊使用介紹,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-02-02
  • Python: tkinter窗口屏幕居中,設(shè)置窗口最大,最小尺寸實(shí)例

    Python: tkinter窗口屏幕居中,設(shè)置窗口最大,最小尺寸實(shí)例

    這篇文章主要介紹了Python: tkinter窗口屏幕居中,設(shè)置窗口最大,最小尺寸實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-03-03

最新評(píng)論