pip ubantu安装mysql_ubuntu上安装mysql+navicat全记录(+pip3安装)

环境

vmware15+ubuntu16.04

目标

在ubuntu下搭建sql环境,并实现与python代码的交互

步骤

主要follow以下几篇博文,具体步骤不详述,记录一些重要的点。

存在以下几个问题:

1.安装完navicat后,打开navicat后全是小方框

1)将安装目录下的start_navicat文件做修改

即将export LANG="en_US.UTF-8" 改为 export LANG="zh_CN.UTF-8"

2)打开navicat后,选择菜单栏中工具-选项

将"常规" "编辑器" "记录" 三个选项里的字体设置,在右边下拉框中选择Noto Sans mono CJK SC Regular/AR PL UMing CN。将这三个部分的字体都设置这个3)如果经历第二步后,发现菜单栏中还是存在方框,那么重启虚拟机,再次打开就能完整显示了

指路一下选项的位置,因为有时候一打开可能就全是框了。

e8edc953cad991020a55873ee5d6c1d0.png

2. 延长navicat的试用期

删除 .navicat64/隐藏文件,再次运行即可

在用户主目录下,生成的隐藏文件夹,ll看这个相关的隐藏文件具体叫啥,因为有的叫./navicat

找到后直接 rm .navicat64/ -r就可以删除了

3. 还有一个大坑就是pip的安装。。。没有记录之前我基本每次安装ubuntu都得重新对着所有的博文摸索很久才装好。。。。

首先要区分pip和pip3,pip3是对应python3-pip的。我这里以pip3为安装目标,其实过程类似。

因为成功安装之后,我使用pip3安装别的python文件,老是会报错

TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'You areusing pip version 8.1.1, however version 19.3.1 isavailable.

You should consider upgrading via the'pip install --upgrade pip' command.

包括我就用它建议的'pip install --upgrade pip'命令,也是报这个错。

所以我想到的唯一办法和亲测有效的办法就是指定安装来源。如下:

//安装

ly@ubuntu:~$ sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

这个时候通过 pip3 --version//报错

ly@ubuntu:~$ pip3 --version

Traceback (most recent call last):

File"/usr/bin/pip3", line 9, in

frompip import main

ImportError: cannot import name'main'

//解决错误

ly@ubuntu:~$ sudo gedit /usr/bin/python3

将该文件中对应部分改为frompip import __main__if __name__ == '__main__':

sys.exit(__main__._main())//正常的显示

ly@ubuntu:~$ pip3 --version

pip19.3.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)

4. 使用pip3安装python库时,出现以下bug,以pymysql为例

ly@ubuntu:~$ sudo pip3 install pymysql

[sudo] passwordforly:

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pymysql/ERROR: Could not find a version that satisfies the requirement pymysql (fromversions: none)

ERROR: No matching distribution foundfor pymysql

通过看别人的博客,发现这个可能是和之前pip3时一样的问题,因为安装源不稳定或者是提供的pip镜像不可用。

目前可用的镜像源有:

使用办法:把它写到配置文件里去

ly@ubuntu:~$ mkdir ~/.pip

ly@ubuntu:~$

ly@ubuntu:~$ cd .pip

ly@ubuntu:~/.pip$ sudo gedit pip.conf //增加配置文件

ly@ubuntu:~/.pip$ sudo pip3 install pymysql

WARNING: The directory'/home/ly/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

WARNING: The directory '/home/ly/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Looking in indexes: http://mirrors.aliyun.com/pypi/simple/

Collecting pymysql

Downloading http://mirrors.aliyun.com/pypi/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whl (47kB)

|████████████████████████████████| 51kB 491kB/s

Installing collected packages: pymysql

Successfully installed pymysql-0.9.3

pip.conf配置文件内容为

[global]

trusted-host=mirrors.aliyun.com

index-url=http://mirrors.aliyun.com/pypi/simple/

ok完工。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值