1.安装pip
apt install python3-pip
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
sudo apt install python3-pip
安装成功, 使用pip3 list
You are using pip version 8.1.1, however version 18.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
pip3 install --upgrade pip
Traceback (most recent call last):
File “/usr/bin/pip3”, line 9, in
from pip import main
ImportError: cannot import name ‘main’
解决方法:
将 /usr/bin/pip 文件中:
from pip import main
if __name__ == '__main__':
sys.exit(main())
改为:
from pip import __main__
if __name__ == '__main__':
sys.exit(__main__._main())
-
安装各种配置
sudo pip3 install numpy
sudo pip3 install scipypython3 -m pip install scipy #pip3 install scikit-learn sudo pip3 install pillow sudo pip3 install h5py sudo pip3 install matplotlib #pip3 install tensorflow 参考: https://www.jianshu.com/p/56c85e29523d https://developer.nvidia.com/embedded/downloads sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp33 tensorflow-gpu sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp33 tensorflow-gpu sudo pip3 install keras sudo pip3 install Flask sudo pip3 install Flask-RESTful
scipy安装:
Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-install-lxaghvd9/scipy/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-rrpjpoly/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-install-lxaghvd9/scipy/
需要更新setuptools
越过pip安装
#sudo apt-get install python3-scipyh5py安装:
Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-install-clhvns2m/h5py/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-hu823puj/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-install-clhvns2m/h5py/sudo apt-get install python3-h5py
matplotlib安装:
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-lva84fcd/matplotlib/
#sudo apt-get install python3-matplotlibsetuptools 20.7.0 更新
sudo pip3 install setuptools==40.5.0 -
不能定位(cannot locate xxx)到软件源的解决方法,执行以下2个命令
sudo apt-key update
sudo apt-get update