Installing Pylint for Python3 on UbuntuInstalling PyQt4 for Python3How can I get pygame for...
Too soon for a plot twist?
Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?
Where is the License file location for Identity Server in Sitecore 9.1?
Can I challenge the interviewer to give me a proper technical feedback?
Is this Paypal Github SDK reference really a dangerous site?
How does a sound wave propagate?
How does learning spells work when leveling a multiclass character?
Limpar string com Regex
PTIJ: Sport in the Torah
How can I have x-axis ticks that show ticks scaled in powers of ten?
Having the player face themselves after the mid-game
Is it a Cyclops number? "Nobody" knows!
Can multiple states demand income tax from an LLC?
ESPP--any reason not to go all in?
Why do we call complex numbers “numbers” but we don’t consider 2-vectors numbers?
School performs periodic password audits. Is my password compromised?
Who has more? Ireland or Iceland?
What would be the most expensive material to an intergalactic society?
Short story about cities being connected by a conveyor belt
How do you make a gun that shoots melee weapons and/or swords?
Averaging over columns while ignoring zero entries
Is there a logarithm base for which the logarithm becomes an identity function?
How to install "rounded" brake pads
Does an unused member variable take up memory?
Installing Pylint for Python3 on Ubuntu
Installing PyQt4 for Python3How can I get pygame for Python3?gi.repository/Python3 example for Indicate?Python3 modulesProper way to install latest version of Python on UbuntuAccidentally deleted Python3 on UbuntuInstall urlgabber module for python3?installing pathos (python3) on ubuntu 16.04Install oauth for python3Ubuntu 18.04 broken python3-disupgrade
My understanding is that the latest release of Pylint (1.0.0 at the time of this writing) has support for Python 3, but I can't get it to work on 64-bit Ubuntu 13.04 with Python 3.3.
I followed the installation instructions on the PyPi site, and Pylint 1.0.0 seems to be installed successfully (pylint --version
returns pylint 1.0.0), and works with Python 2.7 code, but it reports a syntax error when it sees nonlocal statements and such.
What gives? Are there special installation instructions for Pylint on Ubuntu?
python
add a comment |
My understanding is that the latest release of Pylint (1.0.0 at the time of this writing) has support for Python 3, but I can't get it to work on 64-bit Ubuntu 13.04 with Python 3.3.
I followed the installation instructions on the PyPi site, and Pylint 1.0.0 seems to be installed successfully (pylint --version
returns pylint 1.0.0), and works with Python 2.7 code, but it reports a syntax error when it sees nonlocal statements and such.
What gives? Are there special installation instructions for Pylint on Ubuntu?
python
add a comment |
My understanding is that the latest release of Pylint (1.0.0 at the time of this writing) has support for Python 3, but I can't get it to work on 64-bit Ubuntu 13.04 with Python 3.3.
I followed the installation instructions on the PyPi site, and Pylint 1.0.0 seems to be installed successfully (pylint --version
returns pylint 1.0.0), and works with Python 2.7 code, but it reports a syntax error when it sees nonlocal statements and such.
What gives? Are there special installation instructions for Pylint on Ubuntu?
python
My understanding is that the latest release of Pylint (1.0.0 at the time of this writing) has support for Python 3, but I can't get it to work on 64-bit Ubuntu 13.04 with Python 3.3.
I followed the installation instructions on the PyPi site, and Pylint 1.0.0 seems to be installed successfully (pylint --version
returns pylint 1.0.0), and works with Python 2.7 code, but it reports a syntax error when it sees nonlocal statements and such.
What gives? Are there special installation instructions for Pylint on Ubuntu?
python
python
edited Mar 30 '16 at 11:55
serv-inc
1,6251420
1,6251420
asked Sep 3 '13 at 16:40
Jerrad GensonJerrad Genson
151124
151124
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
Python 2 and 3 are separate beasts. If you install a script into the site-packages of one version, you are not installing it into the other.
I'd install it through pip, but you'll need the right version of pip.
sudo apt-get install python3-pip
sudo pip-3.3 install pylint
This will replace your 2.7 version. We can confirm this by checking less $(which pylint)
:
#!/usr/bin/python3.3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint==1.0.0','console_scripts','pylint'
__requires__ = 'pylint==1.0.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()
)
Great. That works. I'll note, however, that those commands did not replace the 2.7 version on my machine. I had to remove it from the 2.7 dist-packages, and then rerun the commands.
– Jerrad Genson
Sep 3 '13 at 17:12
2
@Oli so if I install pylint for python 3 then the default python 2 version doesn't work?
– sayth
Sep 8 '13 at 3:07
3
I found out that with newer versions (as of Python 3.5 etc. Nov 2016) there is also a pylint3 which you can install with:sudo apt install pylint3
.
– Rick Henderson
Nov 27 '16 at 2:32
add a comment |
@sayth 's comment to the accepted answer was what drew me here -- I write both python 2 and python 3 scripts, and I want to be able to check either against the correct ruleset. installing pylint using pip3 install pylint
writes a short script to /usr/local/bin
which invokes the python3 interpreter, and seems, therefore to assume all files to be checked are python 3 scripts.
to work around this, I now have the following files:
~/bin/pylint2
:
#!/usr/bin/python2
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and ~/bin/pylint3
:
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and then, because I like to use pylint directly from Geany's "Build Commands" menu, and I can't specify different commands for python 2 and python 3 scripts, i also have
~/bin/pylint
:
#!/bin/bash
if [[ $(head -n 1 "${@: -1}") == *python3* ]]
then
# python3 file
pylint3 "$@"
else
pylint2 "$@"
fi
which dispatches the correct version by sniffing the shebang.
Not perfect, certainly, but functional and, perhaps, useful for others.
add a comment |
sudo apt install pylint3
Worked for me on Ubuntu 16.04.2 LTS
1
this works for me as well. Installed pylint for python3, and still keep pylint for python 2.
– zhihong
Sep 12 '17 at 15:24
This is the correct answer to me! thank you.
– Evgeny Bobkin
Jun 13 '18 at 15:35
add a comment |
As another method for running pylint on both Python 2 and 3, note that you can use Python's -m
switch to run a module installed on the system in the current version of Python, so you can do
$ python2 -m pylint
$ python3 -m pylint
to explicitly select which one you want. You could make these into aliases or shell scripts if you wanted.
add a comment |
The root of the problem is that pylint should come with entry point console scripts for /usr/local/bin/pylint2 and /usr/local/bin/pylint3. This should be considered a bug.
The following does not work; it still runs pylint2:
python3 -m pylint p3file.py
The following is what I have been using successfully:
python2 /usr/local/bin/pylint p2file.py
python3 /usr/local/bin/pylint p3file.py
add a comment |
This is in response to simons fine answer. I just thought about it in a different way and thought it could be useful for those seeking solutions for multiple versions of python/pylint.
Installing pylint for 3.x and keeping 2.7 default or vise versa is easily done using virtualenv.
Create your virtual environment. in your env while activated run
pip install pylint
here you can then figure out where your env has put your python and pylint by
which pylint
#/home/$USER/Desktop/python/awesomeSauce/bin/pylint
and then
which python
#/home/$USER/Desktop/python/awesomeSauce/bin/python
Then it's just a matter of setting up your ide to use that linting path and/or python path. I know it works with Sublime3 so Ill use that in the example below.
in Sublime in the top header menu select Preferences > Package Settings > Pylinter > Settings - User.
It's just a json object. Set the
"python_bin": "python",
// to the python path found earlier by 'which python'
"python_bin": "/home/$USER/Desktop/python/awesomeSauce/bin/python",
// dont for get the coma if it is the last element.
// We also change the pylint_path from
"pylint_path": null,
// to
"pylint_path": "/home/$USER/Desktop/python/awesomeSauce/bin/pylint",
// sorry I cant make the formatting look any better.
Save the file. I also make a copy of the file and keep it in that venv directory so I can easily switch by copying and pasting this config when I need this linter. When I don't I just reset the Pylinter.sublime-settings back to the default for user and that seems to be the easiest way I have found. Sorry I dont know the windows commands or I would have put them in there.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f340940%2finstalling-pylint-for-python3-on-ubuntu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Python 2 and 3 are separate beasts. If you install a script into the site-packages of one version, you are not installing it into the other.
I'd install it through pip, but you'll need the right version of pip.
sudo apt-get install python3-pip
sudo pip-3.3 install pylint
This will replace your 2.7 version. We can confirm this by checking less $(which pylint)
:
#!/usr/bin/python3.3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint==1.0.0','console_scripts','pylint'
__requires__ = 'pylint==1.0.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()
)
Great. That works. I'll note, however, that those commands did not replace the 2.7 version on my machine. I had to remove it from the 2.7 dist-packages, and then rerun the commands.
– Jerrad Genson
Sep 3 '13 at 17:12
2
@Oli so if I install pylint for python 3 then the default python 2 version doesn't work?
– sayth
Sep 8 '13 at 3:07
3
I found out that with newer versions (as of Python 3.5 etc. Nov 2016) there is also a pylint3 which you can install with:sudo apt install pylint3
.
– Rick Henderson
Nov 27 '16 at 2:32
add a comment |
Python 2 and 3 are separate beasts. If you install a script into the site-packages of one version, you are not installing it into the other.
I'd install it through pip, but you'll need the right version of pip.
sudo apt-get install python3-pip
sudo pip-3.3 install pylint
This will replace your 2.7 version. We can confirm this by checking less $(which pylint)
:
#!/usr/bin/python3.3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint==1.0.0','console_scripts','pylint'
__requires__ = 'pylint==1.0.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()
)
Great. That works. I'll note, however, that those commands did not replace the 2.7 version on my machine. I had to remove it from the 2.7 dist-packages, and then rerun the commands.
– Jerrad Genson
Sep 3 '13 at 17:12
2
@Oli so if I install pylint for python 3 then the default python 2 version doesn't work?
– sayth
Sep 8 '13 at 3:07
3
I found out that with newer versions (as of Python 3.5 etc. Nov 2016) there is also a pylint3 which you can install with:sudo apt install pylint3
.
– Rick Henderson
Nov 27 '16 at 2:32
add a comment |
Python 2 and 3 are separate beasts. If you install a script into the site-packages of one version, you are not installing it into the other.
I'd install it through pip, but you'll need the right version of pip.
sudo apt-get install python3-pip
sudo pip-3.3 install pylint
This will replace your 2.7 version. We can confirm this by checking less $(which pylint)
:
#!/usr/bin/python3.3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint==1.0.0','console_scripts','pylint'
__requires__ = 'pylint==1.0.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()
)
Python 2 and 3 are separate beasts. If you install a script into the site-packages of one version, you are not installing it into the other.
I'd install it through pip, but you'll need the right version of pip.
sudo apt-get install python3-pip
sudo pip-3.3 install pylint
This will replace your 2.7 version. We can confirm this by checking less $(which pylint)
:
#!/usr/bin/python3.3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint==1.0.0','console_scripts','pylint'
__requires__ = 'pylint==1.0.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()
)
answered Sep 3 '13 at 16:50
Oli♦Oli
223k89565765
223k89565765
Great. That works. I'll note, however, that those commands did not replace the 2.7 version on my machine. I had to remove it from the 2.7 dist-packages, and then rerun the commands.
– Jerrad Genson
Sep 3 '13 at 17:12
2
@Oli so if I install pylint for python 3 then the default python 2 version doesn't work?
– sayth
Sep 8 '13 at 3:07
3
I found out that with newer versions (as of Python 3.5 etc. Nov 2016) there is also a pylint3 which you can install with:sudo apt install pylint3
.
– Rick Henderson
Nov 27 '16 at 2:32
add a comment |
Great. That works. I'll note, however, that those commands did not replace the 2.7 version on my machine. I had to remove it from the 2.7 dist-packages, and then rerun the commands.
– Jerrad Genson
Sep 3 '13 at 17:12
2
@Oli so if I install pylint for python 3 then the default python 2 version doesn't work?
– sayth
Sep 8 '13 at 3:07
3
I found out that with newer versions (as of Python 3.5 etc. Nov 2016) there is also a pylint3 which you can install with:sudo apt install pylint3
.
– Rick Henderson
Nov 27 '16 at 2:32
Great. That works. I'll note, however, that those commands did not replace the 2.7 version on my machine. I had to remove it from the 2.7 dist-packages, and then rerun the commands.
– Jerrad Genson
Sep 3 '13 at 17:12
Great. That works. I'll note, however, that those commands did not replace the 2.7 version on my machine. I had to remove it from the 2.7 dist-packages, and then rerun the commands.
– Jerrad Genson
Sep 3 '13 at 17:12
2
2
@Oli so if I install pylint for python 3 then the default python 2 version doesn't work?
– sayth
Sep 8 '13 at 3:07
@Oli so if I install pylint for python 3 then the default python 2 version doesn't work?
– sayth
Sep 8 '13 at 3:07
3
3
I found out that with newer versions (as of Python 3.5 etc. Nov 2016) there is also a pylint3 which you can install with:
sudo apt install pylint3
.– Rick Henderson
Nov 27 '16 at 2:32
I found out that with newer versions (as of Python 3.5 etc. Nov 2016) there is also a pylint3 which you can install with:
sudo apt install pylint3
.– Rick Henderson
Nov 27 '16 at 2:32
add a comment |
@sayth 's comment to the accepted answer was what drew me here -- I write both python 2 and python 3 scripts, and I want to be able to check either against the correct ruleset. installing pylint using pip3 install pylint
writes a short script to /usr/local/bin
which invokes the python3 interpreter, and seems, therefore to assume all files to be checked are python 3 scripts.
to work around this, I now have the following files:
~/bin/pylint2
:
#!/usr/bin/python2
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and ~/bin/pylint3
:
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and then, because I like to use pylint directly from Geany's "Build Commands" menu, and I can't specify different commands for python 2 and python 3 scripts, i also have
~/bin/pylint
:
#!/bin/bash
if [[ $(head -n 1 "${@: -1}") == *python3* ]]
then
# python3 file
pylint3 "$@"
else
pylint2 "$@"
fi
which dispatches the correct version by sniffing the shebang.
Not perfect, certainly, but functional and, perhaps, useful for others.
add a comment |
@sayth 's comment to the accepted answer was what drew me here -- I write both python 2 and python 3 scripts, and I want to be able to check either against the correct ruleset. installing pylint using pip3 install pylint
writes a short script to /usr/local/bin
which invokes the python3 interpreter, and seems, therefore to assume all files to be checked are python 3 scripts.
to work around this, I now have the following files:
~/bin/pylint2
:
#!/usr/bin/python2
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and ~/bin/pylint3
:
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and then, because I like to use pylint directly from Geany's "Build Commands" menu, and I can't specify different commands for python 2 and python 3 scripts, i also have
~/bin/pylint
:
#!/bin/bash
if [[ $(head -n 1 "${@: -1}") == *python3* ]]
then
# python3 file
pylint3 "$@"
else
pylint2 "$@"
fi
which dispatches the correct version by sniffing the shebang.
Not perfect, certainly, but functional and, perhaps, useful for others.
add a comment |
@sayth 's comment to the accepted answer was what drew me here -- I write both python 2 and python 3 scripts, and I want to be able to check either against the correct ruleset. installing pylint using pip3 install pylint
writes a short script to /usr/local/bin
which invokes the python3 interpreter, and seems, therefore to assume all files to be checked are python 3 scripts.
to work around this, I now have the following files:
~/bin/pylint2
:
#!/usr/bin/python2
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and ~/bin/pylint3
:
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and then, because I like to use pylint directly from Geany's "Build Commands" menu, and I can't specify different commands for python 2 and python 3 scripts, i also have
~/bin/pylint
:
#!/bin/bash
if [[ $(head -n 1 "${@: -1}") == *python3* ]]
then
# python3 file
pylint3 "$@"
else
pylint2 "$@"
fi
which dispatches the correct version by sniffing the shebang.
Not perfect, certainly, but functional and, perhaps, useful for others.
@sayth 's comment to the accepted answer was what drew me here -- I write both python 2 and python 3 scripts, and I want to be able to check either against the correct ruleset. installing pylint using pip3 install pylint
writes a short script to /usr/local/bin
which invokes the python3 interpreter, and seems, therefore to assume all files to be checked are python 3 scripts.
to work around this, I now have the following files:
~/bin/pylint2
:
#!/usr/bin/python2
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and ~/bin/pylint3
:
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'pylint','console_scripts','pylint'
__requires__ = 'pylint'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pylint', 'console_scripts', 'pylint')()
)
and then, because I like to use pylint directly from Geany's "Build Commands" menu, and I can't specify different commands for python 2 and python 3 scripts, i also have
~/bin/pylint
:
#!/bin/bash
if [[ $(head -n 1 "${@: -1}") == *python3* ]]
then
# python3 file
pylint3 "$@"
else
pylint2 "$@"
fi
which dispatches the correct version by sniffing the shebang.
Not perfect, certainly, but functional and, perhaps, useful for others.
edited Feb 10 '16 at 17:43
Galgalesh
5,00112453
5,00112453
answered Feb 12 '14 at 1:24
simonsimon
55436
55436
add a comment |
add a comment |
sudo apt install pylint3
Worked for me on Ubuntu 16.04.2 LTS
1
this works for me as well. Installed pylint for python3, and still keep pylint for python 2.
– zhihong
Sep 12 '17 at 15:24
This is the correct answer to me! thank you.
– Evgeny Bobkin
Jun 13 '18 at 15:35
add a comment |
sudo apt install pylint3
Worked for me on Ubuntu 16.04.2 LTS
1
this works for me as well. Installed pylint for python3, and still keep pylint for python 2.
– zhihong
Sep 12 '17 at 15:24
This is the correct answer to me! thank you.
– Evgeny Bobkin
Jun 13 '18 at 15:35
add a comment |
sudo apt install pylint3
Worked for me on Ubuntu 16.04.2 LTS
sudo apt install pylint3
Worked for me on Ubuntu 16.04.2 LTS
answered Jul 17 '17 at 0:00
PhilPhil
17114
17114
1
this works for me as well. Installed pylint for python3, and still keep pylint for python 2.
– zhihong
Sep 12 '17 at 15:24
This is the correct answer to me! thank you.
– Evgeny Bobkin
Jun 13 '18 at 15:35
add a comment |
1
this works for me as well. Installed pylint for python3, and still keep pylint for python 2.
– zhihong
Sep 12 '17 at 15:24
This is the correct answer to me! thank you.
– Evgeny Bobkin
Jun 13 '18 at 15:35
1
1
this works for me as well. Installed pylint for python3, and still keep pylint for python 2.
– zhihong
Sep 12 '17 at 15:24
this works for me as well. Installed pylint for python3, and still keep pylint for python 2.
– zhihong
Sep 12 '17 at 15:24
This is the correct answer to me! thank you.
– Evgeny Bobkin
Jun 13 '18 at 15:35
This is the correct answer to me! thank you.
– Evgeny Bobkin
Jun 13 '18 at 15:35
add a comment |
As another method for running pylint on both Python 2 and 3, note that you can use Python's -m
switch to run a module installed on the system in the current version of Python, so you can do
$ python2 -m pylint
$ python3 -m pylint
to explicitly select which one you want. You could make these into aliases or shell scripts if you wanted.
add a comment |
As another method for running pylint on both Python 2 and 3, note that you can use Python's -m
switch to run a module installed on the system in the current version of Python, so you can do
$ python2 -m pylint
$ python3 -m pylint
to explicitly select which one you want. You could make these into aliases or shell scripts if you wanted.
add a comment |
As another method for running pylint on both Python 2 and 3, note that you can use Python's -m
switch to run a module installed on the system in the current version of Python, so you can do
$ python2 -m pylint
$ python3 -m pylint
to explicitly select which one you want. You could make these into aliases or shell scripts if you wanted.
As another method for running pylint on both Python 2 and 3, note that you can use Python's -m
switch to run a module installed on the system in the current version of Python, so you can do
$ python2 -m pylint
$ python3 -m pylint
to explicitly select which one you want. You could make these into aliases or shell scripts if you wanted.
answered Jul 10 '16 at 22:46
Soren BjornstadSoren Bjornstad
15112
15112
add a comment |
add a comment |
The root of the problem is that pylint should come with entry point console scripts for /usr/local/bin/pylint2 and /usr/local/bin/pylint3. This should be considered a bug.
The following does not work; it still runs pylint2:
python3 -m pylint p3file.py
The following is what I have been using successfully:
python2 /usr/local/bin/pylint p2file.py
python3 /usr/local/bin/pylint p3file.py
add a comment |
The root of the problem is that pylint should come with entry point console scripts for /usr/local/bin/pylint2 and /usr/local/bin/pylint3. This should be considered a bug.
The following does not work; it still runs pylint2:
python3 -m pylint p3file.py
The following is what I have been using successfully:
python2 /usr/local/bin/pylint p2file.py
python3 /usr/local/bin/pylint p3file.py
add a comment |
The root of the problem is that pylint should come with entry point console scripts for /usr/local/bin/pylint2 and /usr/local/bin/pylint3. This should be considered a bug.
The following does not work; it still runs pylint2:
python3 -m pylint p3file.py
The following is what I have been using successfully:
python2 /usr/local/bin/pylint p2file.py
python3 /usr/local/bin/pylint p3file.py
The root of the problem is that pylint should come with entry point console scripts for /usr/local/bin/pylint2 and /usr/local/bin/pylint3. This should be considered a bug.
The following does not work; it still runs pylint2:
python3 -m pylint p3file.py
The following is what I have been using successfully:
python2 /usr/local/bin/pylint p2file.py
python3 /usr/local/bin/pylint p3file.py
answered Mar 8 '17 at 21:44
CurtCurt
211
211
add a comment |
add a comment |
This is in response to simons fine answer. I just thought about it in a different way and thought it could be useful for those seeking solutions for multiple versions of python/pylint.
Installing pylint for 3.x and keeping 2.7 default or vise versa is easily done using virtualenv.
Create your virtual environment. in your env while activated run
pip install pylint
here you can then figure out where your env has put your python and pylint by
which pylint
#/home/$USER/Desktop/python/awesomeSauce/bin/pylint
and then
which python
#/home/$USER/Desktop/python/awesomeSauce/bin/python
Then it's just a matter of setting up your ide to use that linting path and/or python path. I know it works with Sublime3 so Ill use that in the example below.
in Sublime in the top header menu select Preferences > Package Settings > Pylinter > Settings - User.
It's just a json object. Set the
"python_bin": "python",
// to the python path found earlier by 'which python'
"python_bin": "/home/$USER/Desktop/python/awesomeSauce/bin/python",
// dont for get the coma if it is the last element.
// We also change the pylint_path from
"pylint_path": null,
// to
"pylint_path": "/home/$USER/Desktop/python/awesomeSauce/bin/pylint",
// sorry I cant make the formatting look any better.
Save the file. I also make a copy of the file and keep it in that venv directory so I can easily switch by copying and pasting this config when I need this linter. When I don't I just reset the Pylinter.sublime-settings back to the default for user and that seems to be the easiest way I have found. Sorry I dont know the windows commands or I would have put them in there.
add a comment |
This is in response to simons fine answer. I just thought about it in a different way and thought it could be useful for those seeking solutions for multiple versions of python/pylint.
Installing pylint for 3.x and keeping 2.7 default or vise versa is easily done using virtualenv.
Create your virtual environment. in your env while activated run
pip install pylint
here you can then figure out where your env has put your python and pylint by
which pylint
#/home/$USER/Desktop/python/awesomeSauce/bin/pylint
and then
which python
#/home/$USER/Desktop/python/awesomeSauce/bin/python
Then it's just a matter of setting up your ide to use that linting path and/or python path. I know it works with Sublime3 so Ill use that in the example below.
in Sublime in the top header menu select Preferences > Package Settings > Pylinter > Settings - User.
It's just a json object. Set the
"python_bin": "python",
// to the python path found earlier by 'which python'
"python_bin": "/home/$USER/Desktop/python/awesomeSauce/bin/python",
// dont for get the coma if it is the last element.
// We also change the pylint_path from
"pylint_path": null,
// to
"pylint_path": "/home/$USER/Desktop/python/awesomeSauce/bin/pylint",
// sorry I cant make the formatting look any better.
Save the file. I also make a copy of the file and keep it in that venv directory so I can easily switch by copying and pasting this config when I need this linter. When I don't I just reset the Pylinter.sublime-settings back to the default for user and that seems to be the easiest way I have found. Sorry I dont know the windows commands or I would have put them in there.
add a comment |
This is in response to simons fine answer. I just thought about it in a different way and thought it could be useful for those seeking solutions for multiple versions of python/pylint.
Installing pylint for 3.x and keeping 2.7 default or vise versa is easily done using virtualenv.
Create your virtual environment. in your env while activated run
pip install pylint
here you can then figure out where your env has put your python and pylint by
which pylint
#/home/$USER/Desktop/python/awesomeSauce/bin/pylint
and then
which python
#/home/$USER/Desktop/python/awesomeSauce/bin/python
Then it's just a matter of setting up your ide to use that linting path and/or python path. I know it works with Sublime3 so Ill use that in the example below.
in Sublime in the top header menu select Preferences > Package Settings > Pylinter > Settings - User.
It's just a json object. Set the
"python_bin": "python",
// to the python path found earlier by 'which python'
"python_bin": "/home/$USER/Desktop/python/awesomeSauce/bin/python",
// dont for get the coma if it is the last element.
// We also change the pylint_path from
"pylint_path": null,
// to
"pylint_path": "/home/$USER/Desktop/python/awesomeSauce/bin/pylint",
// sorry I cant make the formatting look any better.
Save the file. I also make a copy of the file and keep it in that venv directory so I can easily switch by copying and pasting this config when I need this linter. When I don't I just reset the Pylinter.sublime-settings back to the default for user and that seems to be the easiest way I have found. Sorry I dont know the windows commands or I would have put them in there.
This is in response to simons fine answer. I just thought about it in a different way and thought it could be useful for those seeking solutions for multiple versions of python/pylint.
Installing pylint for 3.x and keeping 2.7 default or vise versa is easily done using virtualenv.
Create your virtual environment. in your env while activated run
pip install pylint
here you can then figure out where your env has put your python and pylint by
which pylint
#/home/$USER/Desktop/python/awesomeSauce/bin/pylint
and then
which python
#/home/$USER/Desktop/python/awesomeSauce/bin/python
Then it's just a matter of setting up your ide to use that linting path and/or python path. I know it works with Sublime3 so Ill use that in the example below.
in Sublime in the top header menu select Preferences > Package Settings > Pylinter > Settings - User.
It's just a json object. Set the
"python_bin": "python",
// to the python path found earlier by 'which python'
"python_bin": "/home/$USER/Desktop/python/awesomeSauce/bin/python",
// dont for get the coma if it is the last element.
// We also change the pylint_path from
"pylint_path": null,
// to
"pylint_path": "/home/$USER/Desktop/python/awesomeSauce/bin/pylint",
// sorry I cant make the formatting look any better.
Save the file. I also make a copy of the file and keep it in that venv directory so I can easily switch by copying and pasting this config when I need this linter. When I don't I just reset the Pylinter.sublime-settings back to the default for user and that seems to be the easiest way I have found. Sorry I dont know the windows commands or I would have put them in there.
answered 14 mins ago
tldrtldr
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f340940%2finstalling-pylint-for-python3-on-ubuntu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown