我是在ubuntu中,自带的有python2,python3有安装了anaconda套件,所以python的版本很多,曾经想删除过不用的python.

先执行

sudo apt remove python*

在想安装anaconda,结果悲剧了,xorg没有了,结果只能cmd玩耍了,一气之下重装ubuntu18系统了

dflx@dflx:~$ ps -t tty1
PID TTY TIME CMD
1889 tty1 00:00:00 gdm-x-session
1891 tty1 00:11:38 Xorg
2051 tty1 00:00:00 gnome-session-b
2365 tty1 00:16:43 gnome-shell
2520 tty1 00:00:00 ibus-daemon

我的python情况

dflx@dflx:~$ python
python python3 python3.6m python3m
python2 python3.6 python3.6m-config python3m-config
python2.7 python3.6-config python3-config

python路径

dflx@dflx:~$ whereis python
python: /usr/bin/python2.7
/usr/bin/python3.6m-config
/usr/bin/python /usr/bin/python3.6
/usr/bin/python3.6m
/usr/bin/python3.6-config
/usr/lib/python2.7
/usr/lib/python3.7
/usr/lib/python3.6
/etc/python2.7
/etc/python /etc/python3.6 /usr/local/lib/python2.7 /usr/local/lib/python3.6 /usr/include/python3.6 /usr/include/python3.6m /usr/share/python /home/dflx/anaconda3/bin/python3.6m-config /home/dflx/anaconda3/bin/python /home/dflx/anaconda3/bin/python3.6 /home/dflx/anaconda3/bin/python3.6m /home/dflx/anaconda3/bin/python3.6-config /usr/share/man/man1/python.1.gz
dflx@dflx:~$ which python
/home/dflx/anaconda3/bin/python

find查找命令
find <指定目录> <指定条件> <指定动作>“;
比如使用find命令,搜索在根目录下的所有condarc文件[anaconda源配置文件]所在位置,命令格式为find / -name "condarc"


dflx@dflx:~$ find / -name "condarc"
find: ‘/tmp/systemd-private-f3c0644e26174362bd722c3ae1177b11-systemd-timesyncd.service-58avLb’: 权限不够
find: ‘/tmp/systemd-private-f3c0644e26174362bd722c3ae1177b11-bolt.service-lPkFIh’: 权限不够
find: ‘/tmp/vmware-root’: 权限不够
find: ‘/tmp/pulse-PKdhtXMmr18n’: 权限不够
find: ‘/tmp/systemd-private-f3c0644e26174362bd722c3ae1177b11-colord.service-vIICqI’: 权限不够
/home/dflx/anaconda3/pkgs/conda-4.4.10-py36_0/info/test/tests/condarc
/home/dflx/anaconda3/pkgs/conda-4.5.4-py36_0/info/test/tests/condarc

cat 查看

dflx@dflx:~$ cat /home/dflx/anaconda3/pkgs/conda-4.4.10-py36_0/info/test/tests/condarc
# This is a sample .condarc file # channel locations. These override conda defaults, i.e., conda will
# search *only* the channels listed here, in the order given. Use "defaults" to
# automatically include all default channels. Non-url channels will be
# interpreted as binstar usernames (this can be changed by modifying the
# channel_alias key; see below).
channels:
- binstar_username
- http://some.custom/channel
- defaults # Alias to use for non-url channels used with the -c flag. Default is https://conda.binstar.org/ ............

查看另外一个

dflx@dflx:~$ cat /home/dflx/anaconda3/pkgs/conda-4.5.4-py36_0/info/test/tests/condarc
# This is a sample .condarc file # channel locations. These override conda defaults, i.e., conda will
# search *only* the channels listed here, in the order given. Use "defaults" to
# automatically include all default channels. Non-url channels will be
# interpreted as binstar usernames (this can be changed by modifying the
# channel_alias key; see below).
channels:
- binstar_username
- http://some.custom/channel
- defaults # Alias to use for non-url channels used with the -c flag. Default is https://conda.binstar.org/ channel_alias: https://your.repo/ # Proxy settings: http://[username]:[password]@[server]:[port]
proxy_servers:
http: http://user:pass@corp.com:8080
https: https://user:pass@corp.com:8080

查看源url

dflx@dflx:~$ conda config --show
add_anaconda_token: True
add_pip_as_python_dependency: True
aggressive_update_packages:
- ca-certificates
- certifi
- openssl
allow_non_channel_urls: False
allow_softlinks: False
always_copy: False
always_softlink: False
always_yes: None
anaconda_upload: None
auto_update_conda: True
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: True
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- defaults
- conda-forge

在就是配置了一下多环境,我把vscode配ubuntu本身的python环境.因为我的selenium包,怎么在conda都安装不上.

dflx@dflx:~$ conda list
#只放了s 开头的包
scikit-image 0.13.1 py36h14c3975_1 defaults
scikit-learn 0.19.1 py36h7aa7ec6_0 defaults
scipy 1.0.0 py36hbf646e7_0 defaults
Scrapy 1.5.0 <pip>
seaborn 0.8.1 py36hfad7ec4_0 defaults
send2trash 1.4.2 py36_0 defaults
service-identity 17.0.0 <pip>
setuptools 38.4.0 py36_0 defaults
simplegeneric 0.8.1 py36_2 defaults
singledispatch 3.4.0.3 py36h7a266c3_0 defaults
sip 4.18.1 py36h51ed4ed_2 defaults
six 1.11.0 py36h372c433_1 defaults
snowballstemmer 1.2.1 py36h6febd40_0 defaults
sortedcollections 0.5.3 py36h3c761f9_0 defaults
sortedcontainers 1.5.9 py36_0 defaults
sphinx 1.6.6 py36_0 defaults
sphinxcontrib 1.0 py36h6d0f590_1 defaults
sphinxcontrib-websupport 1.0.1 py36hb5cb234_1 defaults
spyder 3.2.6 py36_0 defaults
sqlalchemy 1.2.1 py36h14c3975_0 defaults
sqlite 3.22.0 h1bed415_0 defaults
statsmodels 0.8.0 py36h8533d0b_0 defaults
sympy 1.1.1 py36hc6d1c1c_0 defaults
tblib

然而ubuntu自带的python包的情况如下

dflx@dflx:~$ pip3 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
requests-unixsocket (0.1.5)
SecretStorage (2.3.1)
selenium (3.12.0)
setuptools (39.1.0)
simplejson (3.15.0)
six (1.11.0)
system-service (0.3)
systemd-python (234)
traitlets (4.3.2)

我anaconda安装selenium好像出错,我已经修改源的来源了.........

dflx@dflx:~$ conda install selenium
Solving environment: failed # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< `$ /home/dflx/anaconda3/bin/conda install selenium` environment variables:
CIO_TEST=<not set>
CLASSPATH=.::/opt/java/jdk-9.0.1/lib:/opt/java/jdk-9.0.1/jre/lib
CONDA_ROOT=/home/dflx/anaconda3
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
PATH=/home/dflx/anaconda3/bin:/home/dflx/.local/bin:/usr/local/sbin:/usr/lo
cal/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sna
p/bin:/opt/java/jdk-9.0.1/bin:/opt/java/jdk-9.0.1/jre/bin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
WINDOWPATH=1
ftp_proxy=<set>
http_proxy=<set>
https_proxy=<set>
socks_proxy=<set> active environment : None
user config file : /home/dflx/.condarc
populated config files : /home/dflx/.condarc
conda version : 4.5.4
conda-build version : 3.4.1
python version : 3.6.4.final.0
base environment : /home/dflx/anaconda3 (writable)
channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/linux-64
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/noarch
package cache : /home/dflx/anaconda3/pkgs
/home/dflx/.conda/pkgs
envs directories : /home/dflx/anaconda3/envs
/home/dflx/.conda/envs
platform : linux-64
user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.4 Linux/4.15.0-23-generic ubuntu/18.10 glibc/2.27
UID:GID : 1000:1000
netrc file : None
offline mode : False V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/linux-64/repodata.json>
Elapsed: - An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ProxyError(MaxRetryError("HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /anaconda/cloud/msys2/linux-64/repodata.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f693e9ef780>: Failed to establish a new connection: [Errno 111] Connection refused',)))",),) A reportable application error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]: n No report sent. To permanently opt-out, use $ conda config --set report_errors false

估计解决不了了,不折腾,采用自带python测试一下.

终于找到bug了,应该是代理服务的鬼

在使用wegt下载的时候发现的

dflx@dflx:~$ wget https://bootstrap.pypa.io/get-pip.py
--2018-06-22 16:37:01-- https://bootstrap.pypa.io/get-pip.py
正在连接 127.0.0.1:8888... 失败:拒绝连接。

使用netstat查看本地端口的使用情况

dflx@dflx:~$ sudo netstat -ntpl
激活Internet连接 (仅服务器)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:902 0.0.0.0:* LISTEN 1865/vmware-authdla
tcp 0 0 0.0.0.0:8084 0.0.0.0:* LISTEN 1313/mono
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 762/systemd-resolve
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 942/cupsd
tcp6 0 0 :::902 :::* LISTEN 1865/vmware-authdla
tcp6 0 0 ::1:631 :::* LISTEN 942/cupsd

发现并没有服务在占用端口8888

查看本地网络是否走了代理服务

dflx@dflx:~$ export | grep -i prox
declare -x ftp_proxy=""
declare -x http_proxy="127.0.0.1:8888"
declare -x https_proxy="127.0.0.1:8888"
declare -x socks_proxy=""

在找到了被占用的端口的8888, 确实是走了代理,于是问题找到了。

关闭服务

dflx@dflx:~$ unset https_proxy
dflx@dflx:~$ export | grep -i prox
declare -x ftp_proxy=""
declare -x http_proxy="127.0.0.1:8888"
declare -x socks_proxy=""

测试selenium,可以使用

from selenium import webdriver
req_url= "http://www.haosou.com/s?ie=utf-8&shb=1&src=360sou_newhome&q=python"
browser= webdriver.Firefox()
browser.get(req_url)

vscode控制带的结果 厦门叉车市场

dflx@dflx:~/文档/python$ cd /home/dflx/文档/python ;
env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" /usr/bin/python3m /home/dflx/.vscode/extensions/ms-python.python-2018.6.0/pythonFiles/PythonTools/visualstudio_py_launcher.py
/home/dflx/文档/python 42367 34806ad9-833a-4524-8cd6-18ca4aa74f14
RedirectOutput,RedirectOutput /home/dflx/文档/python/bloy.py

参考文章
Linux下怎样搜索文件
CondaHTTPError: HTTP 000 CONNECTION FAILED for url
wget 正在连接 127.0.0.1:36627... 失败:拒绝连接

python所遇到的坑的更多相关文章

  1. python中的这些坑,早看早避免。

    python中的这些坑,早看早避免. 说一说python中遇到的坑,躲坑看这一篇就够了 传递参数时候不要使用列表 def foo(num,age=[]): age.append(num) print( ...

  2. 学Python要避免哪些坑,如何巩固好基础

    学Python要避免哪些坑?零基础怎么入门Python?Python入门简单.语法简洁.功能强大,非常适合零基础入门IT行业的人学习.随着人工智能时代的来临,企业纷纷选择使用Python进行开发,Py ...

  3. 决策树python建模中的坑 :ValueError: Expected 2D array, got 1D array instead:

    决策树python建模中的坑 代码 #coding=utf-8 from sklearn.feature_extraction import DictVectorizerimport csvfrom ...

  4. Python的16个“坑”

    1. 不要使用可变对象作为函数默认值 代码如下: In [1]: def append_to_list(value, def_list=[]): ...: def_list.append(value) ...

  5. 用Java执行Python:Jython踩坑笔记

    常见的java调用python脚本方式 1.通过Jython.jar提供的类库实现 2.通过Runtime.getRuntime()开启进程来执行脚本文件 1.Jython Jpython使用时,版本 ...

  6. Python默认参数的坑

    默认参数的坑 定义一个函数,传入一个list,添加一个end再返回 def add_end(L=[]): L.append('END') return L 正常调用时,结果似乎不错 print add ...

  7. Python 中的那些坑总结——持续更新

    1.三元表达式之坑 很显然,Python把第一行的(10 + 4)看成了三元表达式的前部分,这个坑是看了<Python cookbook>(P5)中学到的,书中的代码: 2.Python生 ...

  8. Python的15个坑

    1. 不要使用可变对象作为函数默认值 代码如下: In [1]: def append_to_list(value, def_list=[]):    ...:         def_list.ap ...

  9. python网络编程的坑(持续更新)

    初学python,踩了许多坑...每天都学一点吧..(大佬绕过) 1.session的用法: session是python requests库中的一个重要功能.session可以存储用户的数据并且存储 ...

  10. python之tkinter入坑Pack()------(1)

    tkinter 的pack()可以设置的属性如下: pack_configure(self, cnf={}, **kw)Pack a widget in the parent widget. Use  ...

随机推荐

  1. ethereumjs/ethereumjs-common-3-test

    查看test能够让你更好滴了解其API文档的使用 ethereumjs-common/tests/chains.js const tape = require('tape') const Common ...

  2. windows同时安装python2和python3

    系统之前安装了python2.7,现在准备装个python3.6 1:首先下载一个python3.6适合windows32位的包python-3.6.5.exe 然后直接默认双击安装,安装的时候勾选a ...

  3. Jmeter之post上传文件

    上周五东西都收拾好了,然后被叫住加班,直接搞到凌晨一两点,原因是另一个项目的性能出了点问题.为此我抓包写了一下主业务流的接口,涉及到文件上传,记录一下吧. 一.创建线程组,添加各类组件 这个就不用说了 ...

  4. .Net文档下载

    public static void DownLoadFile(string fileName, HttpResponse Response, HttpServerUtility Server) { ...

  5. 在 .NET Core项目中使用UEditor图片、文件上传服务

    在.NET Framework中使用UEditor时,只需要将UEditor提供的后端服务,部署为一个子程序,即可直接使用文件上传相关的服务,但是UEditor官方并未提供.Net Core的项目,并 ...

  6. Angular动态表单生成(八)

    动态表单生成之拖拽生成表单(下) 我们的动态表单,最终要实现的效果与Form.io的在线生成表单的效果类似,可以参考它的demo地址:https://codepen.io/travist/full/x ...

  7. 在Linux环境下设置ArcGIS Server 服务开机自启

    在 VMware 11.0 中安装了CentOS 6.5的Linux系统中部署ArcGIS Server,安装完后默认开机不自动启动此服务,每次开机都要手动启动(如下图所示),这样太麻烦.本文记录了设 ...

  8. Gym100025K

    矩阵快速幂 设答案为f(i) 举个例子: 当i==2时,包含0的值有:10,20,30,40,50,60,70,80,90,100:0的个数为11,f(2)=11; i==3时;可以从i==2的情况递 ...

  9. 一、Delphi中Cxgrid表格滚动条粗细设置

    1.Delphi VCL新版本的Cxgrid滚动条默认是触屏模式(如下图),很细的滚动条,在电脑版显示非常不方便. 2.如果需要改成传统的滚动条模式,需要设置一下LookAndFeel里面的Scrol ...

  10. JavaWeb基础—JS学习小结

    JavaScript是一种运行在浏览器中的解释型的编程语言 推荐:菜鸟教程一.简介js:javascript是基于对象[哪些基本对象呢]和和事件驱动[哪些主要事件呢]的语言,应用在客户端(注意与面向对 ...