python环境变量及Pycharm配置

python环境变量及Pycharm配置

目录

  • 前言
    • python环境配置
    • 卸载pip
  • 错误处理

前言

python环境配置

  • 下载:https://www.python.org/downloads/

  • 双击运行 python-2.7.13.msi,一路next,然后将 C:\Python27 添加至 Path 环境变量。

  • cmd打开命令窗口,输入python出现以下内容,配置成功

    1
    2
    Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
  • [使用]安装pip,cmd窗口下,python -m pip install -U pip, 等待完成。出现Successfully installed pip-19.1.1安装成功。

  • [不使用]下载最新版pip安装包,https://pypi.org/project/pip/#files;解压 pip-19.1.1.tar.gz 到指定目录,cmd进入该目录,执行 python setup.py install 进行安装,然后将 C:\Python27\Scripts 添加至 Path 环境变量。

  • 安装依赖

    pip install -r requirements.txt

  • 打包exe

    运行 pyinstaller aaa.py 进行打包exe。

  • pip文档:https://pip.pypa.io/en/stable/installing/

卸载pip

1
python -m pip uninstall pip

错误处理

Pycharm报:Please select a valid Python interpreter

打开setting
输入interpreter,看到project interpreter,选择一个Project Interpreter

pycharm使用-201972218231

Traceback (most recent call last):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Traceback (most recent call last):
File "D:\DevTools\JetBrains\PyCharm 2018.3.7\helpers\pydev\pydevd.py", line 1741, in <module>
main()
File "D:\DevTools\JetBrains\PyCharm 2018.3.7\helpers\pydev\pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\DevTools\JetBrains\PyCharm 2018.3.7\helpers\pydev\pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:/kyee/projects/EMR/medinsproxy/app.py", line 4, in <module>
from adapter import *
File "D:\kyee\projects\EMR\medinsproxy\adapter.py", line 14, in <module>
fileConfig('./logging.conf')
File "D:\DevTools\Python27\lib\logging\config.py", line 77, in fileConfig
formatters = _create_formatters(cp)
File "D:\DevTools\Python27\lib\logging\config.py", line 113, in _create_formatters
flist = cp.get("formatters", "keys")
File "D:\DevTools\Python27\lib\ConfigParser.py", line 607, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'formatters'

解决办法【暂未解决】:执行pip install medinsproxy;