python中的常用命令

conda创建新环境

conda create --name yourEnv python=2.7 
#或者
conda create -n yourEnv python=3.6 numpy pandas

激活环境并且安装相关包

zutnlp@zutnlp:~$ source activate wyd_dl
(wyd_dl) zutnlp@zutnlp:~$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Keras
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Keras'
>>> import keras
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'keras'
>>> exit()
(wyd_dl) zutnlp@zutnlp:~$ pip install keras
Collecting keras
  Using cached https://files.pythonhosted.org/packages/5e/10/aa32dad071ce52b5502266b5c659451cfd6ffcbf14e6c8c4f16c0ff5aaab/Keras-2.2.4-py2.py3-none-any.whl
Requirement already satisfied: scipy>=0.14 in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from keras) (1.2.1)
Collecting keras-preprocessing>=1.0.5 (from keras)
  Downloading https://files.pythonhosted.org/packages/28/6a/8c1f62c37212d9fc441a7e26736df51ce6f0e38455816445471f10da4f0a/Keras_Preprocessing-1.1.0-py2.py3-none-any.whl (41kB)
     |████████████████████████████████| 51kB 20kB/s 
Collecting pyyaml (from keras)
  Downloading https://files.pythonhosted.org/packages/a3/65/837fefac7475963d1eccf4aa684c23b95aa6c1d033a2c5965ccb11e22623/PyYAML-5.1.1.tar.gz (274kB)
     |████████████████████████████████| 276kB 19kB/s 
Requirement already satisfied: six>=1.9.0 in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from keras) (1.12.0)
Collecting keras-applications>=1.0.6 (from keras)
  Downloading https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl (50kB)
     |████████████████████████████████| 51kB 22kB/s 
Requirement already satisfied: numpy>=1.9.1 in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from keras) (1.16.2)
Requirement already satisfied: h5py in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from keras) (2.9.0)
Building wheels for collected packages: pyyaml
  Building wheel for pyyaml (setup.py) ... done
  Stored in directory: /home/zutnlp/.cache/pip/wheels/16/27/a1/775c62ddea7bfa62324fd1f65847ed31c55dadb6051481ba3f
Successfully built pyyaml
Installing collected packages: keras-preprocessing, pyyaml, keras-applications, keras
Successfully installed keras-2.2.4 keras-applications-1.0.8 keras-preprocessing-1.1.0 pyyaml-5.1.1
(wyd_dl) zutnlp@zutnlp:~$ pip uninstall keras && pip install keras==1.2.4
Uninstalling Keras-2.2.4:
  Would remove:
    /home/zutnlp/anaconda3/envs/wyd_dl/lib/python3.6/site-packages/Keras-2.2.4.dist-info/*
    /home/zutnlp/anaconda3/envs/wyd_dl/lib/python3.6/site-packages/docs/*
    /home/zutnlp/anaconda3/envs/wyd_dl/lib/python3.6/site-packages/keras/*
Proceed (y/n)? y
  Successfully uninstalled Keras-2.2.4
Collecting keras==1.2.4
  ERROR: Could not find a version that satisfies the requirement keras==1.2.4 (from versions: 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1, 1.2.2, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4)
ERROR: No matching distribution found for keras==1.2.4
(wyd_dl) zutnlp@zutnlp:~$ pip uninstall keras && pip install keras==1.2.2
WARNING: Skipping keras as it is not installed.
Collecting keras==1.2.2
  Downloading https://files.pythonhosted.org/packages/75/3e/9926ce5c678b7a7978724a2ecf24857d89a415d152b8d3443e6d45c228b2/Keras-1.2.2.tar.gz (175kB)
     |████████████████████████████████| 184kB 27kB/s 
Requirement already satisfied: theano in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from keras==1.2.2) (0.9.0)
Requirement already satisfied: pyyaml in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from keras==1.2.2) (5.1.1)
Requirement already satisfied: six in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from keras==1.2.2) (1.12.0)
Requirement already satisfied: numpy>=1.9.1 in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from theano->keras==1.2.2) (1.16.2)
Requirement already satisfied: scipy>=0.14 in ./anaconda3/envs/wyd_dl/lib/python3.6/site-packages (from theano->keras==1.2.2) (1.2.1)
Building wheels for collected packages: keras
  Building wheel for keras (setup.py) ... done
  Stored in directory: /home/zutnlp/.cache/pip/wheels/55/07/cf/b32db0a8d243b2fd6759d5d7cb650aa20670b2b740209cbf7e
Successfully built keras
Installing collected packages: keras
Successfully installed keras-1.2.2
(wyd_dl) zutnlp@zutnlp:~$ 
Socket error Event: 32 Error: 10053.
Connection closing...Socket close.

reference:https://blog.csdn.net/SARACH_WONG/article/details/89328307

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

aijava1

请我喝咖啡!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值