如果是因为python37安装不了tensorflow,就不需要往下看了
$ pip --version
pip 18.1
$ python --version
Python 3.7.0
$ pip install tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
$ pip search tensorflow
tensorflow (1.12.0) - TensorFlow is an open source machine learning framework for everyone.
$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
$ python
Python 3.7.0 (default, Jun 28 2018, 07:39:16)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
ImportError: numpy.core.multiarray failed to import
ImportError: numpy.core.umath failed to import
ImportError: numpy.core.umath failed to import
2018-12-05 15:05:32.236362: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr
zsh: abort python
$ pip install -U numpy
$ python
Python 3.7.0 (default, Oct 18 2018, 15:08:12)
[Clang 10.0.0 (clang-1000.10.44.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.6 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.7
return f(*args, **kwds)
>>> tensorflow.__version__
'1.12.0'
1.安装anaconda3
#~/.bashrc
alias python3="/home/zhaodachuan/anaconda3/bin/python"
alias pip3="/home/zhaodachuan/anaconda3/bin/pip"
alias pip3env="/home/zhaodachuan/anaconda3/bin/pipenv"
#~/.bash_profile
if test -f .bashrc ; then
source .bashrc
fi
2.创建虚拟环境
conda create --name python36 python=3.6
conda info --envs
3.虚拟环境(要改成自己的python3.6路径)
pip3env --python /home/op/anaconda3/envs/python36/bin/python
pip3env shell
pip3env install(注意先还源)
pip3env install async
附加:
pipenv换源
vim Pipfile
[[source]]
name = "Tsinghua"
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
verify_ssl = true
升级vim到8
git clone https://github.com/vim/vim.git
cd vim/src
sudo yum install libncurses5-dev
sudo make