Skip to content
Snippets Groups Projects
Readme-python.txt 3.48 KiB
Newer Older
Sous Windows, VSCode et Python 3.7.2
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
> pip3
Fatal error in launcher: Unable to create process using '"'
[ntird-us191-jg4:jgrelet]/c/git/python/pirata
> python3 -m pip install --upgrade pip
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
Successfully installed pip-19.0.3
[ntird-us191-jg4:jgrelet]/c/git/python/pirata
jacques Grelet's avatar
jacques Grelet committed

Sous Linux Ubuntu 16.04, l'upgrade de pip failed !
---------------------------------------------------
voir: https://askubuntu.com/questions/1025793/running-pip3-importerror-cannot-import-name-main
jacques Grelet's avatar
jacques Grelet committed
Utiliser:
> python3 -m pip install --user <package>  # instead
jacques Grelet's avatar
jacques Grelet committed
Then I recommend adding the following aliases to your .bashrc:
pip() ( python -m pip "$@" )
pip3() ( python3 -m pip "$@" )

jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
> pip install toml
Collecting toml
  Downloading https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
Installing collected packages: toml
Successfully installed toml-0.10.0

Il est prefereable d'installer la derniere version Python 3.7.2

Configuration du fichier setting.json de jgrelet:

// Placez vos paramètres dans ce fichier pour remplacer les paramètres par défaut
{
    "go.gopath": "C:/Users/jgrelet/go",
    "go.goroot": "c:/go",
    "git.path": "C:\\Program Files\\Git\\bin",
    //"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe",
    //"terminal.integrated.shellArgs.windows": ["/K", "C:\\opt\\cmder\\vscode.bat"],
    //"terminal.integrated.shell.windows": "C:\\msys64\\usr\\bin\\bash.exe",
    "terminal.integrated.shell.windows": "C:\\MinGW\\msys\\1.0\\bin\\bash.exe",
    //"terminal.integrated.shellArgs.windows": ["--login", "-i"],
   // "terminal.integrated.cwd": "/c/Users/jgrelet/go/src/bitbucket.org/jgrelet/raspberry/go/go-serial",
    //"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe",
    //"terminal.integrated.shellArgs.windows": ["/k", "C:\\opt\\TDM-GCC-64\\mingwvars.bat"],
    "matlab.mlintpath": "C:\\Program Files\\MATLAB\\R2016b\\bin\\win64\\mlint.exe",
    "files.associations": {
        "*.m": "matlab"
    },
   // "vim.enableNeovim": false,
    //"http.proxy": "http://antea:3128"
    "workbench.colorTheme": "Visual Studio Dark",
    "go.liveErrors": {
        "enabled": true,
        "delay": 500
    },
    "git.autofetch": true,
    "git.enableSmartCommit": true,
    "explorer.confirmDelete": false,
    "team.showWelcomeMessage": false,
    //"files.autoSave": "afterDelay"
}

Pour utiliser le bash de git, modifier la ligne:
    "terminal.integrated.shell.windows": "C:\\MinGW\\msys\\1.0\\bin\\bash.exe",
par
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    
Add in user setting.json:
  "[python]": {
        "editor.insertSpaces": true,
        "editor.tabSize": 4
    }

In setting.json:

    "python.linting.pylintEnabled": true,
    "python.linting.enabled": true,
    "python.linting.mypyEnabled": false,
    "python.pythonPath": "C:\\opt\\python\\python3.7\\python.exe",
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "python.autoComplete.addBrackets": true,
    "editor.formatOnPaste": true
Modules Python à intaller:
--------------------------
Autoformatting
----------------------
> pip install autopep8
Installer l'extension Python-autopep8
Cmd+P choisir autopip
> pip install pylint

Developpement:
> pip install pynmea2
> pip install pySerial
> pip install netCDF4
> pip install seawater
> pip install numpy

Tests avec unittest:
--------------------
Les fichiers de tests sont sous tests
> python -m unittest -v tests/test_roscop.py