easy_install: command not found 的解決辦法

因爲

hellopython@ubuntu:~$ mkvirtualenv -p /user/local/bin/python3 dm
mkvirtualenv: command not found

所以參照了 https://blog.csdn.net/liu_xzhen/article/details/79293373 ,結果:

hellopython@ubuntu:~$ sudo easy_install virtualenvwrapper
sudo: easy_install: command not found

解決辦法(第一個sudo python2 -m easy_install virtualenvwrapper 說找不到某個包是因爲網絡太慢,後來連上手機熱點,網速快了後,同樣的命令就成功了。
)

hellopython@ubuntu:~$ sudo python2 -m easy_install virtualenvwrapper
[sudo] password for hellopython: 
Searching for virtualenvwrapper
Reading https://pypi.org/simple/virtualenvwrapper/
Download error on https://pypi.org/simple/virtualenvwrapper/: [Errno -2] Name or service not known -- Some packages may not be found!
Couldn't find index page for 'virtualenvwrapper' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [Errno -2] Name or service not known -- Some packages may not be found!
No local packages or working download links found for virtualenvwrapper
error: Could not find suitable distribution for Requirement.parse('virtualenvwrapper')
hellopython@ubuntu:~$ sudo python2 easy_install virtualenvwrapper
[sudo] password for hellopython: 
python2: can't open file 'easy_install': [Errno 2] No such file or directory
hellopython@ubuntu:~$ sudo python2 -m easy_install virtualenvwrapper
Searching for virtualenvwrapper
Reading https://pypi.org/simple/virtualenvwrapper/
Downloading https://files.pythonhosted.org/packages/c1/6b/2f05d73b2d2f2410b48b90d3783a0034c26afa534a4a95ad5f1178d61191/virtualenvwrapper-4.8.4.tar.gz#sha256=51a1a934e7ed0ff221bdd91bf9d3b604d875afbb3aa2367133503fee168f5bfa
Best match: virtualenvwrapper 4.8.4
Processing virtualenvwrapper-4.8.4.tar.gz
Writing /tmp/easy_install-gfG3cV/virtualenvwrapper-4.8.4/setup.cfg
Running virtualenvwrapper-4.8.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-gfG3cV/virtualenvwrapper-4.8.4/egg-dist-tmp-AqWCvm
Moving virtualenvwrapper-4.8.4-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding virtualenvwrapper 4.8.4 to easy-install.pth file
Installing virtualenvwrapper_lazy.sh script to /usr/local/bin
Installing virtualenvwrapper.sh script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/virtualenvwrapper-4.8.4-py2.7.egg
Processing dependencies for virtualenvwrapper
Searching for stevedore
Reading https://pypi.org/simple/stevedore/
Downloading https://files.pythonhosted.org/packages/b1/e1/f5ddbd83f60b03f522f173c03e406c1bff8343f0232a292ac96aa633b47a/stevedore-1.31.0-py2.py3-none-any.whl#sha256=01d9f4beecf0fbd070ddb18e5efb10567801ba7ef3ddab0074f54e3cd4e91730
Best match: stevedore 1.31.0
Processing stevedore-1.31.0-py2.py3-none-any.whl
Installing stevedore-1.31.0-py2.py3-none-any.whl to /usr/local/lib/python2.7/dist-packages
writing requirements to /usr/local/lib/python2.7/dist-packages/stevedore-1.31.0-py2.7.egg/EGG-INFO/requires.txt
Adding stevedore 1.31.0 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/stevedore-1.31.0-py2.7.egg
Searching for virtualenv-clone
Reading https://pypi.org/simple/virtualenv-clone/
Downloading https://files.pythonhosted.org/packages/ba/f8/50c2b7dbc99e05fce5e5b9d9a31f37c988c99acd4e8dedd720b7b8d4011d/virtualenv_clone-0.5.3-py2.py3-none-any.whl#sha256=532f789a5c88adf339506e3ca03326f20ee82fd08ee5586b44dc859b5b4468c5
Best match: virtualenv-clone 0.5.3
Processing virtualenv_clone-0.5.3-py2.py3-none-any.whl
Installing virtualenv_clone-0.5.3-py2.py3-none-any.whl to /usr/local/lib/python2.7/dist-packages
Adding virtualenv-clone 0.5.3 to easy-install.pth file
Installing virtualenv-clone script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/virtualenv_clone-0.5.3-py2.7.egg
Searching for pbr!=2.1.0,>=2.0.0
Reading https://pypi.org/simple/pbr/
Downloading https://files.pythonhosted.org/packages/46/a4/d5c83831a3452713e4b4f126149bc4fbda170f7cb16a86a00ce57ce0e9ad/pbr-5.4.3-py2.py3-none-any.whl#sha256=b32c8ccaac7b1a20c0ce00ce317642e6cf231cf038f9875e0280e28af5bf7ac9
Best match: pbr 5.4.3
Processing pbr-5.4.3-py2.py3-none-any.whl
Installing pbr-5.4.3-py2.py3-none-any.whl to /usr/local/lib/python2.7/dist-packages
Adding pbr 5.4.3 to easy-install.pth file
Installing pbr script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/pbr-5.4.3-py2.7.egg
Finished processing dependencies for virtualenvwrapper

hellopython@ubuntu:~$ cd /usr/local/bin
hellopython@ubuntu:/usr/local/bin$ ls
pbr  virtualenv-clone  virtualenvwrapper_lazy.sh  virtualenvwrapper.sh

補充:
python2 -m easy_install virtualenvwrapper 大概意思是:指定導入python2解釋器下的easy_install模塊後運行來安裝virtualenvwrapper 。如果有錯還請指正
所以如果你的python2沒有easy_install.py 這樣的工具包,還是另尋其它方法吧。

hellopython@ubuntu:~$ easy_install --version
setuptools 41.6.0 from /home/hellopython/.local/lib/python2.7/site-packages (Python 2.7)
hellopython@ubuntu:~$ sudo easy_install virtualenvwrapper
sudo: easy_install: command not found
hellopython@ubuntu:~$ cd /home/hellopython/.local/lib/python2.7/site-packages 
hellopython@ubuntu:~/.local/lib/python2.7/site-packages$ ls

decorator-4.4.1.dist-info                       retry
decorator.py                                    retry-0.9.2.dist-info
decorator.pyc                                   scrapy
easy_install.py                                 Scrapy-1.8.0.dist-info
easy_install.pyc                                selenium
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章