if you get a
E492: Not an editor command: Python << PYTHONEOF
or a
import jedi
ImportError: No module named jedi
go into your /jedi-vim folder and run
git submodule update --init
also add
if has('python')
command! -nargs=1 Python python <args>
else
command! -nargs=1 Python python3 <args>
end
to jedi-vim/autoload/jedi.vim
Related
What is the simplest way to make an alias for python -m myproject when the user installs the package myproject via pip?
Can poetry manages that?
Remainder: python -m myproject launches myproject/__main__.py.
It is possible. With Poetry, it is solved by its scripts feature in the pyproject.toml:
[tool.poetry.scripts]
my-command = "myproject.__main__:my_main"
where my_main is a function in myproject/__main__.py:
def my_main():
# ...
if __name__ == '__main__':
my_main()
From then on, you can poetry install again and then the my-command executable is available. Later, when one "pip-installs" your project, they also have the my-command executable available.
I can customized the installing process in develop mode by setup.py like below:
from setuptools import setup
from setuptools.command import develop
class CustomDevelop(develop.develop, object):
"""
Class needed for "pip install -e ."
"""
def run(self):
super(CustomDevelop, self).run()
print("CustomDevelop=====================")
install_requires = ["numpy"]
setup(
name="example_package",
version="0.0.1",
packages=["example_package"],
cmdclass={'develop': CustomDevelop},
)
When running python3 -m pip install -vvv -e ., the output is
Running setup.py develop for example-package
Running command python setup.py develop
running develop
running egg_info
writing example_package.egg-info/PKG-INFO
writing dependency_links to example_package.egg-info/dependency_links.txt
writing top-level names to example_package.egg-info/top_level.txt
reading manifest file 'example_package.egg-info/SOURCES.txt'
writing manifest file 'example_package.egg-info/SOURCES.txt'
running build_ext
Creating /home/example_package/venv_example_package/lib/python3.8/site-packages/example-package.egg-link (link to .)
Adding example-package 0.0.1 to easy-install.pth file
Installed /home/lai/example_package
CustomDevelop=====================
However, it's not possible to do it with PEP518 which introduces pyproject.toml. Is there a workaround for this issue?
I've created a python tool and want to install it via brew. Creating the formula worked fine at first when i simply had one python file named myTool. Then i seperated the code into more files as it became larger and more complex.
How do i set up the install to bundle those files, because right now the imports are failing because the other files are not found.
My current install
def install
bin.install 'myTool'
end
The error shown when running the brew installed tool
from myModule import someFunc, someOtherFunc ModuleNotFoundError: No module named 'myModule'
The current setup only installs the angler file without any of the other python modules. This results in the ModuleNotFoundError error. Here is my suggestion:
def install
# Determines the python version being used
# e.g. If python3.10, xy = 3.10
xy = Language::Python.major_minor_version "python3"
# Where to install the python files
packages = libexec/"lib/python#{xy}/site-packages/angler"
# For each file present, install them in the right location
%w[angler anglerEnums.py anglerGen.py anglerHelperFunctions.py].each do |file|
packages.install file
end
# Create a symlink to the angler python file
bin.install_symlink packages/"angler"
end
I would like to install a package from a git repository specifying a commit id using pipenv (I belive it should be very similar If I would use pip)
so far I tried:
pipenv install "git+ssh://git#bitbucket.org/<username>/<repository>.git/<commit_id>#egg=mypackage"
which is apending the following line to the Pipfile & provides no errors
<package-name> = {git = "ssh://git#bitbucket.org/<username>/<repository>.git/<commit_id>"}
If I import the package import mypackage it detects it but its dependencies are missing.
The setup.py of mypackage looks like;
import setuptools
with open("README.md", "r") as readme:
long_description = readme.read()
with open("./requirements.txt", "r") as fh:
requirements = fh.readlines()
setuptools.setup(
name='mypackage',
url='https://bitbucket.org/<username>/<repositroy>',
packages=setuptools.find_packages(),
install_requires=[req for req in requirements if req[0] not in ["#", "-"]],
)
Just figured it out by reading this that the revision id should be specified after a #
pipenv install "git+ssh://git#bitbucket.org/<username>/<repository>.git#<commit_id>#egg=<package_name>"
I want to install BeautifulSoup, I use python3.5 on Mac
I have tried many methods:
I try to download beautifulsoup4-4.4.1.tar.gz from official website,and in terminal type:
$ cd [my path]
$ sudo python3.5 ./setup.py install
I also tried:
$ sudo pip3 install beautifulsoup4
and the terminal says:
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/beautifulsoup4-4.4.1-py3.5.egg
So I think it is already installed,
but when In python3 I type (I use pycharm)
from bs4 import BeautifulSoup
It says
Traceback (most recent call last):
File "", line 1, in
File "/Applications/PyCharm Edu.app/Contents/helpers/pydev/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named 'bs4'
Did I install bs4 properly?
How can I import bs4 into python3?
I have solved this porblem!
just as #Martjin Pieters said,PyCharm can install packages by Menu Operation:
PyCharm -> Preference -> Project -> Project interpreter
Check if you are using python3 and click "+" at the bottom (If you see BeatifulSoup in the frame, click "-" to uninstall it first) then you can install it properly
see this picture