重装Python 、Anaconda、Pycharm、Pytorch

系统 2489 0

重装Python 、Anaconda、Pycharm、Pytorch 1.0.0  Tensorflow系统:

在安装PyQt库的时候Python2.7与3.6版本不兼容,导致Python运行程序报错:process finished with exit code -1073741819 (0xC0000005) ,重新配置python版本也没作用,只好重装系统。

1,Anaconda 下载安装(https://www.anaconda.com/download/),Anaconda最新版本基于python 3.7版本的,但目前Tensorflow还不提供python 3.7的安装包,因此在Tensorflow安装时还需额外的配置修改。Anaconda可以选择安装python 3.6版本的,Tensorflow直接可以下载安装。

2,安装Pycharm开发集成环境。(https://www.jetbrains.com/pycharm/)

3,安装Pytorch 1.0.0版本。

            
              C:\Users\lenovo>python
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
  File "
              
                ", line 1, in 
                
                  
ModuleNotFoundError: No module named 'torch'
                
              
            
          
            
              G:\ProgramData\Anaconda3\Scripts>pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-win_amd64.whl
torch-1.0.0-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
You are using pip version 18.0, however version 19.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

G:\ProgramData\Anaconda3\Scripts>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 78kB/s
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-19.0.1

G:\ProgramData\Anaconda3\Scripts>pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-win_amd64.whl
Collecting torch==1.0.0 from https://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-win_amd64.whl
  Downloading https://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-win_amd64.whl (71.0MB)
    100% |████████████████████████████████| 71.0MB 102kB/s
Installing collected packages: torch
Successfully installed torch-1.0.0

G:\ProgramData\Anaconda3\Scripts>pip3 install torchvision
Collecting torchvision
  Using cached https://files.pythonhosted.org/packages/ca/0d/f00b2885711e08bd71242ebe7b96561e6f6d01fdb4b9dcf4d37e2e13c5e1/torchvision-0.2.1-py2.py3-none-any.whl
Requirement already satisfied: pillow>=4.1.1 in g:\programdata\anaconda3\lib\site-packages (from torchvision) (5.3.0)
Requirement already satisfied: torch in g:\programdata\anaconda3\lib\site-packages (from torchvision) (1.0.0)
Requirement already satisfied: six in g:\programdata\anaconda3\lib\site-packages (from torchvision) (1.12.0)
Requirement already satisfied: numpy in g:\programdata\anaconda3\lib\site-packages (from torchvision) (1.15.4)
Installing collected packages: torchvision
Successfully installed torchvision-0.2.1

            
          

Pytorch导入成功。

            
              >>> import torch
            
          

至此,Pytorch 1.0.0安装成功! 

4,Tensorflow安装。 

 Anaconda安装的是python3.7的版本,Tensorflow支持python3.6以下的版本,并不直接支持python3.7,因此下载Tensorflow whl的版本以后需更改文件名进行安装。
# Windows CPU
# 下载https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.12.0-cp36-cp36m-win_amd64.whl
# 重命名文件,将36改为37
pip install tensorflow-1.12.0-cp37-cp37m-win_amd64.whl 进行安装

            
              G:\ProgramData\Anaconda3\Scripts>pip install tensorflow
Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

G:\ProgramData\Anaconda3\Scripts>pip3 install --upgrade --ignore-installed tensorflow
Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
 

G:\ProgramData\Anaconda3\Scripts>pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
Collecting tensorflow==1.12.0 from https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
  Downloading https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl (62.0MB)
    3% |█                               | 2.3MB 244kB/s eta 0:04:04Could not install packages due to an EnvironmentError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2471)


G:\ProgramData\Anaconda3\Scripts>pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
Collecting tensorflow==1.12.0 from https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
  Downloading https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl (62.0MB)
    3% |█                               | 2.3MB 245kB/s eta 0:04:04Could not install packages due to an EnvironmentError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2471)


G:\ProgramData\Anaconda3\Scripts>pip install tensorflow-1.12.0-cp37-cp37m-win_amd64.whl
Requirement 'tensorflow-1.12.0-cp37-cp37m-win_amd64.whl' looks like a filename, but the file does not exist
Processing g:\programdata\anaconda3\scripts\tensorflow-1.12.0-cp37-cp37m-win_amd64.whl
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'G:\\ProgramData\\Anaconda3\\Scripts\\tensorflow-1.12.0-cp37-cp37m-win_amd64.whl'


G:\ProgramData\Anaconda3\Scripts>pip install tensorflow-1.12.0-cp36-cp37m-win_amd64.whl
tensorflow-1.12.0-cp36-cp37m-win_amd64.whl is not a supported wheel on this platform.

G:\ProgramData\Anaconda3\Scripts>pip install tensorflow-1.12.0-cp37-cp37m-win_amd64.whl
Processing g:\programdata\anaconda3\scripts\tensorflow-1.12.0-cp37-cp37m-win_amd64.whl
Collecting grpcio>=1.8.6 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/17/80/b135a60dfb12e9e0d691e4e66020b6f90fd8864e17ed5c719881bdea7d41/grpcio-1.18.0-cp37-cp37m-win_amd64.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 2.1MB/s
Collecting keras-applications>=1.0.6 (from tensorflow==1.12.0)
  Using cached https://files.pythonhosted.org/packages/3f/c4/2ff40221029f7098d58f8d7fb99b97e8100f3293f9856f0fb5834bef100b/Keras_Applications-1.0.6-py2.py3-none-any.whl
Collecting gast>=0.2.0 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/4e/35/11749bf99b2d4e3cceb4d55ca22590b0d7c2c62b9de38ac4a4a7f4687421/gast-0.2.2.tar.gz
Requirement already satisfied: numpy>=1.13.3 in g:\programdata\anaconda3\lib\site-packages (from tensorflow==1.12.0) (1.15.4)
Collecting astor>=0.6.0 (from tensorflow==1.12.0)
  Using cached https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting protobuf>=3.6.1 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/77/78/a7f1ce761e2c738e209857175cd4f90a8562d1bde32868a8cd5290d58926/protobuf-3.6.1-py2.py3-none-any.whl (390kB)
    100% |████████████████████████████████| 399kB 58kB/s
Collecting termcolor>=1.1.0 (from tensorflow==1.12.0)
  Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Requirement already satisfied: wheel>=0.26 in g:\programdata\anaconda3\lib\site-packages (from tensorflow==1.12.0) (0.32.3)
Collecting absl-py>=0.1.6 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/31/bc/ab68120d1d89ae23b694a55fe2aece2f91194313b71f9b05a80b32d3c24b/absl-py-0.7.0.tar.gz (96kB)
    100% |████████████████████████████████| 102kB 86kB/s
Collecting keras-preprocessing>=1.0.5 (from tensorflow==1.12.0)
  Using cached https://files.pythonhosted.org/packages/fc/94/74e0fa783d3fc07e41715973435dd051ca89c550881b3454233c39c73e69/Keras_Preprocessing-1.0.5-py2.py3-none-any.whl
Collecting tensorboard<1.13.0,>=1.12.0 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/07/53/8d32ce9471c18f8d99028b7cef2e5b39ea8765bd7ef250ca05b490880971/tensorboard-1.12.2-py3-none-any.whl (3.0MB)
    100% |████████████████████████████████| 3.1MB 70kB/s
Requirement already satisfied: six>=1.10.0 in g:\programdata\anaconda3\lib\site-packages (from tensorflow==1.12.0) (1.12.0)
Requirement already satisfied: h5py in g:\programdata\anaconda3\lib\site-packages (from keras-applications>=1.0.6->tensorflow==1.12.0) (2.8.0)
Requirement already satisfied: setuptools in g:\programdata\anaconda3\lib\site-packages (from protobuf>=3.6.1->tensorflow==1.12.0) (40.6.3)
Requirement already satisfied: werkzeug>=0.11.10 in g:\programdata\anaconda3\lib\site-packages (from tensorboard<1.13.0,>=1.12.0->tensorflow==1.12.0) (0.14.1)
Collecting markdown>=2.6.8 (from tensorboard<1.13.0,>=1.12.0->tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl (89kB)
    100% |████████████████████████████████| 92kB 56kB/s
Building wheels for collected packages: gast, termcolor, absl-py
  Building wheel for gast (setup.py) ... done
  Stored in directory: C:\Users\lenovo\AppData\Local\pip\Cache\wheels\5c\2e\7e\a1d4d4fcebe6c381f378ce7743a3ced3699feb89bcfbdadadd
  Building wheel for termcolor (setup.py) ... done
  Stored in directory: C:\Users\lenovo\AppData\Local\pip\Cache\wheels\7c\06\54\bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6
  Building wheel for absl-py (setup.py) ... done
  Stored in directory: C:\Users\lenovo\AppData\Local\pip\Cache\wheels\90\db\f8\2c3101f72ef1ad434e4662853174126ce30201a3e163dcbeca
Successfully built gast termcolor absl-py
Installing collected packages: grpcio, keras-applications, gast, astor, protobuf, termcolor, absl-py, keras-preprocessing, markdown, tensorboard, tensorflow
Successfully installed absl-py-0.7.0 astor-0.7.1 gast-0.2.2 grpcio-1.18.0 keras-applications-1.0.6 keras-preprocessing-1.0.5 markdown-3.0.1 protobuf-3.6.1 tensorboard-1.12.2 tensorflow-1.12.0 termcolor-1.1.0

G:\ProgramData\Anaconda3\Scripts>
            
          


Windows无法import tensorflow,提示“找不到DLL” :

            
              >>> import tensorflow
Traceback (most recent call last):
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in 
              
                
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in 
                
                  
    _pywrap_tensorflow_internal = swig_import_helper()
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "G:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "G:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: Module use of python36.dll conflicts with this version of Python.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "
                  
                    ", line 1, in 
                    
                      
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in 
                      
                        
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in 
                        
                          
    from tensorflow.python import pywrap_tensorflow
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in 
                          
                            
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in 
                            
                              
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in 
                              
                                
    _pywrap_tensorflow_internal = swig_import_helper()
  File "G:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "G:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "G:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: Module use of python36.dll conflicts with this version of Python.

                              
                            
                          
                        
                      
                    
                  
                
              
            
          

需要修改_pywrap_tensorflow_internal.pyd,从网上下载已经更新的_pywrap_tensorflow_internal.pyd 文件,覆盖以下目录中的同文件(G:\ProgramData\Anaconda3\Lib\site-packages\tensorflow\python)。https://www.jianshu.com/p/1a3e194886b4网友提供的_pywrap_tensorflow_internal.pyd 下载的地址:https://pan.baidu.com/s/14jTm2LUmjmvSgYsjyNJ9hw 提取码: i453
重装Python 、Anaconda、Pycharm、Pytorch 1.0.0 Tensorflow_第1张图片

 然后,重新导入Tensorflow成功。

            
              >>> import tensorflow
>>>


            
          

 


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论